]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - cmd_migrate.c
cmd_device: add missing short options to usage
[bcachefs-tools-debian] / cmd_migrate.c
index 3fe2e4ef2b1cec83614fa79e315bd661b61e2f98..177884da197b141ab76634fcb2fef9107aab2892 100644 (file)
@@ -31,6 +31,7 @@
 #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"
@@ -120,7 +121,7 @@ static void update_inode(struct bch_fs *c,
 
        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));
 }
@@ -238,8 +239,9 @@ static void copy_xattrs(struct bch_fs *c, struct bch_inode_unpacked *dst,
 
                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));
        }
@@ -267,7 +269,7 @@ static void write_data(struct bch_fs *c,
        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);
@@ -344,11 +346,11 @@ static void link_data(struct bch_fs *c, struct bch_inode_unpacked *dst,
                        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));
 
@@ -788,8 +790,8 @@ int cmd_migrate(int argc, char *argv[])
 
 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"