]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - cmd_migrate.c
Improved the show-super group and target printing
[bcachefs-tools-debian] / cmd_migrate.c
index 177884da197b141ab76634fcb2fef9107aab2892..9523dbdd16d78f6fd0ec1feff7cb649599419cbe 100644 (file)
@@ -25,6 +25,8 @@
 #include <linux/generic-radix-tree.h>
 #include <linux/xattr.h>
 #include "libbcachefs/bcachefs.h"
+#include "libbcachefs/alloc_background.h"
+#include "libbcachefs/alloc_foreground.h"
 #include "libbcachefs/btree_update.h"
 #include "libbcachefs/buckets.h"
 #include "libbcachefs/dirent.h"
@@ -248,7 +250,6 @@ static void copy_xattrs(struct bch_fs *c, struct bch_inode_unpacked *dst,
 }
 
 static char buf[1 << 20] __aligned(PAGE_SIZE);
-static const size_t buf_pages = sizeof(buf) / PAGE_SIZE;
 
 static void write_data(struct bch_fs *c,
                       struct bch_inode_unpacked *dst_inode,
@@ -256,7 +257,7 @@ static void write_data(struct bch_fs *c,
 {
        struct {
                struct bch_write_op op;
-               struct bio_vec bv[buf_pages];
+               struct bio_vec bv[sizeof(buf) / PAGE_SIZE];
        } o;
        struct closure cl;
 
@@ -265,7 +266,7 @@ static void write_data(struct bch_fs *c,
 
        closure_init_stack(&cl);
 
-       bio_init(&o.op.wbio.bio, o.bv, buf_pages);
+       bio_init(&o.op.wbio.bio, o.bv, ARRAY_SIZE(o.bv));
        o.op.wbio.bio.bi_iter.bi_size = len;
        bch2_bio_map(&o.op.wbio.bio, buf);