#include "libbcachefs/fs.h"
#include "libbcachefs/inode.h"
#include "libbcachefs/io.h"
+#include "libbcachefs/replicas.h"
#include "libbcachefs/str_hash.h"
#include "libbcachefs/super.h"
#include "libbcachefs/xattr.h"
bch2_inode_pack(&packed, inode);
ret = bch2_btree_insert(c, BTREE_ID_INODES, &packed.inode.k_i,
- NULL, NULL, NULL, 0);
+ NULL, NULL, 0);
if (ret)
die("error creating file: %s", strerror(-ret));
}
const struct xattr_handler *h = xattr_resolve_name(&attr);
- int ret = __bch2_xattr_set(c, dst->bi_inum, &hash_info, attr,
- val, val_size, 0, h->flags, NULL);
+ int ret = bch2_trans_do(c, NULL, BTREE_INSERT_ATOMIC,
+ bch2_xattr_set(&trans, dst->bi_inum, &hash_info, attr,
+ val, val_size, h->flags, 0));
if (ret < 0)
die("error creating xattr: %s", strerror(-ret));
}
o.op.wbio.bio.bi_iter.bi_size = len;
bch2_bio_map(&o.op.wbio.bio, buf);
- bch2_write_op_init(&o.op, c);
+ bch2_write_op_init(&o.op, c, bch2_opts_to_inode_opts(c->opts));
o.op.write_point = writepoint_hashed(0);
o.op.nr_replicas = 1;
o.op.pos = POS(dst_inode->bi_inum, dst_offset >> 9);
die("error reserving space in new filesystem: %s",
strerror(-ret));
- bch2_check_mark_super(c, BCH_DATA_USER,
- bch2_bkey_devs(extent_i_to_s_c(e).s_c));
+ bch2_mark_bkey_replicas(c, BCH_DATA_USER,
+ extent_i_to_s_c(e).s_c);
ret = bch2_btree_insert(c, BTREE_ID_EXTENTS, &e->k_i,
- &res, NULL, NULL, 0);
+ &res, NULL, 0);
if (ret)
die("btree insert error %s", strerror(-ret));
"\n"
"After verifying that the new filesystem is correct, to create a\n"
"superblock at the default offset and finish the migration run\n"
- " bcachefs migrate_superblock -d %s -o %llu\n"
+ " bcachefs migrate-superblock -d %s -o %llu\n"
"\n"
"The new filesystem will have a file at /old_migrated_filestem\n"
"referencing all disk space that might be used by the existing\n"
"filesystem. That file can be deleted once the old filesystem is\n"
"no longer needed (and should be deleted prior to running\n"
- "bcachefs migrate_superblock)\n",
+ "bcachefs migrate-superblock)\n",
sb_offset, dev.path, dev.path, sb_offset);
return 0;
}
static void migrate_superblock_usage(void)
{
- puts("bcachefs migrate_superblock - create default superblock after migrating\n"
- "Usage: bcachefs migrate_superblock [OPTION]...\n"
+ puts("bcachefs migrate-superblock - create default superblock after migrating\n"
+ "Usage: bcachefs migrate-superblock [OPTION]...\n"
"\n"
"Options:\n"
" -d device Device to create superblock for\n"