]> 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 5914e46d6fc8440b3f84b1bbe86dd8f95fd1bac3..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));
 
@@ -739,13 +741,13 @@ static int migrate_fs(const char *fs_path,
               "\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;
 }
@@ -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"