]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - cmd_data.c
fix list_journal for nochanges
[bcachefs-tools-debian] / cmd_data.c
index 25a2dcb22cd0631b41010d1c7fa2b3776a39a6ed..1ef689bc6f67b270ca2906ad0938a80d6c60b284 100644 (file)
@@ -5,10 +5,24 @@
 
 #include "libbcachefs/bcachefs_ioctl.h"
 #include "libbcachefs/btree_cache.h"
+#include "libbcachefs/move.h"
 
 #include "cmds.h"
 #include "libbcachefs.h"
 
+int data_usage(void)
+{
+       puts("bcachefs data - manage filesystem data\n"
+            "Usage: bcachefs data <CMD> [OPTIONS]\n"
+            "\n"
+            "Commands:\n"
+            "  rereplicate                     Rereplicate degraded data\n"
+            "  job                             Kick off low level data jobs\n"
+            "\n"
+            "Report bugs to <linux-bcachefs@vger.kernel.org>");
+       return 0;
+}
+
 static void data_rereplicate_usage(void)
 {
        puts("bcachefs data rereplicate\n"
@@ -19,7 +33,7 @@ static void data_rereplicate_usage(void)
             "\n"
             "Options:\n"
             "  -h, --help                  display this help and exit\n"
-            "Report bugs to <linux-bcache@vger.kernel.org>");
+            "Report bugs to <linux-bcachefs@vger.kernel.org>");
        exit(EXIT_SUCCESS);
 }
 
@@ -42,7 +56,7 @@ int cmd_data_rereplicate(int argc, char *argv[])
                die("too many arguments");
 
        return bchu_data(bcache_fs_open(fs_path), (struct bch_ioctl_data) {
-               .op             = BCH_DATA_OP_REREPLICATE,
+               .op             = BCH_DATA_OP_rereplicate,
                .start_btree    = 0,
                .start_pos      = POS_MIN,
                .end_btree      = BTREE_ID_NR,
@@ -57,25 +71,17 @@ static void data_job_usage(void)
             "\n"
             "Kick off a data job and report progress\n"
             "\n"
-            "job: one of scrub, rereplicate, migrate, or rewrite_old_nodes\n"
+            "job: one of scrub, rereplicate, migrate, rewrite_old_nodes, or drop_extra_replicas\n"
             "\n"
             "Options:\n"
             "  -b btree                    btree to operate on\n"
             "  -s inode:offset       start position\n"
             "  -e inode:offset       end position\n"
             "  -h, --help                  display this help and exit\n"
-            "Report bugs to <linux-bcache@vger.kernel.org>");
+            "Report bugs to <linux-bcachefs@vger.kernel.org>");
        exit(EXIT_SUCCESS);
 }
 
-const char * const data_jobs[] = {
-       "scrub",
-       "rereplicate",
-       "migrate",
-       "rewrite_old_nodes",
-       NULL
-};
-
 int cmd_data_job(int argc, char *argv[])
 {
        struct bch_ioctl_data op = {
@@ -90,7 +96,7 @@ int cmd_data_job(int argc, char *argv[])
                switch (opt) {
                case 'b':
                        op.start_btree = read_string_list_or_die(optarg,
-                                               bch2_btree_ids, "btree id");
+                                               __bch2_btree_ids, "btree id");
                        op.end_btree = op.start_btree;
                        break;
                case 's':
@@ -108,10 +114,7 @@ int cmd_data_job(int argc, char *argv[])
        if (!job)
                die("please specify which type of job");
 
-       op.op = read_string_list_or_die(job, data_jobs, "bad job type");
-
-       if (op.op == BCH_DATA_OP_SCRUB)
-               die("scrub not implemented yet");
+       op.op = read_string_list_or_die(job, bch2_data_ops_strs, "bad job type");
 
        char *fs_path = arg_pop();
        if (!fs_path)