#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));
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"