]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - bcachefs.c
Update bcachefs sources to b12d1535f3 bcachefs: fix bounds checks in bch2_bio_map()
[bcachefs-tools-debian] / bcachefs.c
index d57a46ea066ac416711157ede10e4f369af79bb9..910e0b16fadfe44d63da2e55ecfd7c13044b6232 100644 (file)
@@ -29,44 +29,51 @@ static void usage(void)
             "usage: bcachefs <command> [<args>]\n"
             "\n"
             "Superblock commands:\n"
-            "  format           Format a new filesystem\n"
-            "  show-super       Dump superblock information to stdout\n"
+            "  format               Format a new filesystem\n"
+            "  show-super           Dump superblock information to stdout\n"
             "\n"
             "Repair:\n"
-            "  fsck             Check an existing filesystem for errors\n"
+            "  fsck                 Check an existing filesystem for errors\n"
             "\n"
             "Startup/shutdown, assembly of multi device filesystems:\n"
-            "  assemble         Assemble an existing multi device filesystem\n"
-            "  incremental      Incrementally assemble an existing multi device filesystem\n"
-            "  run              Start a partially assembled filesystem\n"
-            "  stop             Stop a running filesystem\n"
-
+#if 0
+            "  assemble             Assemble an existing multi device filesystem\n"
+            "  incremental          Incrementally assemble an existing multi device filesystem\n"
+            "  run                  Start a partially assembled filesystem\n"
+            "  stop                   Stop a running filesystem\n"
+#endif
+            "\n"
             "Commands for managing a running filesystem:\n"
-            "  fs show          Show various information about a filesystem\n"
-            "  fs set           Modify filesystem options\n"
+            "  fs usage             Show disk usage\n"
             "\n"
             "Commands for managing devices within a running filesystem:\n"
-            "  device add       Add a new device to an existing filesystem\n"
-            "  device remove    Remove a device from an existing filesystem\n"
-            "  device online    Readd an existing member to a filesystem\n"
-            "  device offline   Take a device offline, without removing it\n"
-            "  device evacuate  Migrate data off of a specific device\n"
-            "  device set-state Mark a device as failed\n"
+            "  device add           Add a new device to an existing filesystem\n"
+            "  device remove        Remove a device from an existing filesystem\n"
+            "  device online        Re-add an existing member to a filesystem\n"
+            "  device offline       Take a device offline, without removing it\n"
+            "  device evacuate      Migrate data off of a specific device\n"
+            "  device set-state     Mark a device as failed\n"
+            "  device resize        Resize filesystem on a device\n"
+            "\n"
+            "Commands for managing filesystem data:\n"
+            "  data rereplicate     Rereplicate degraded data\n"
             "\n"
             "Encryption:\n"
-            "  unlock           Unlock an encrypted filesystem prior to running/mounting\n"
-            "  set-passphrase   Change passphrase on an existing (unmounted) filesystem\n"
-            "  remove-passphrase Remove passphrase on an existing (unmounted) filesystem\n"
+            "  unlock               Unlock an encrypted filesystem prior to running/mounting\n"
+            "  set-passphrase       Change passphrase on an existing (unmounted) filesystem\n"
+            "  remove-passphrase    Remove passphrase on an existing (unmounted) filesystem\n"
             "\n"
             "Migrate:\n"
-            "  migrate          Migrate an existing filesystem to bcachefs, in place\n"
-            "  migrate-superblock\n"
-            "                   Add default superblock, after bcachefs migrate\n"
+            "  migrate              Migrate an existing filesystem to bcachefs, in place\n"
+            "  migrate-superblock   Add default superblock, after bcachefs migrate\n"
             "\n"
             "Debug:\n"
             "These commands work on offline, unmounted filesystems\n"
-            "  dump             Dump filesystem metadata to a qcow2 image\n"
-            "  list             List filesystem metadata in textual form\n");
+            "  dump                 Dump filesystem metadata to a qcow2 image\n"
+            "  list                 List filesystem metadata in textual form\n"
+            "\n"
+            "Miscellaneous:\n"
+            "  version              Display the version of the invoked bcachefs tool\n");
 }
 
 static char *full_cmd;
@@ -91,10 +98,8 @@ static int fs_cmds(int argc, char *argv[])
 {
        char *cmd = pop_cmd(&argc, argv);
 
-       if (!strcmp(cmd, "show"))
-               return cmd_fs_show(argc, argv);
-       if (!strcmp(cmd, "set"))
-               return cmd_fs_set(argc, argv);
+       if (!strcmp(cmd, "usage"))
+               return cmd_fs_usage(argc, argv);
 
        usage();
        return 0;
@@ -113,9 +118,22 @@ static int device_cmds(int argc, char *argv[])
        if (!strcmp(cmd, "offline"))
                return cmd_device_offline(argc, argv);
        if (!strcmp(cmd, "evacuate"))
-               return cmd_device_offline(argc, argv);
+               return cmd_device_evacuate(argc, argv);
        if (!strcmp(cmd, "set-state"))
                return cmd_device_set_state(argc, argv);
+       if (!strcmp(cmd, "resize"))
+               return cmd_device_resize(argc, argv);
+
+       usage();
+       return 0;
+}
+
+static int data_cmds(int argc, char *argv[])
+{
+       char *cmd = pop_cmd(&argc, argv);
+
+       if (!strcmp(cmd, "rereplicate"))
+               return cmd_data_rereplicate(argc, argv);
 
        usage();
        return 0;
@@ -129,6 +147,8 @@ int main(int argc, char *argv[])
 
        char *cmd = pop_cmd(&argc, argv);
 
+       if (!strcmp(cmd, "version"))
+               return cmd_version(argc, argv);
        if (!strcmp(cmd, "format"))
                return cmd_format(argc, argv);
        if (!strcmp(cmd, "show-super"))
@@ -137,6 +157,7 @@ int main(int argc, char *argv[])
        if (!strcmp(cmd, "fsck"))
                return cmd_fsck(argc, argv);
 
+#if 0
        if (!strcmp(cmd, "assemble"))
                return cmd_assemble(argc, argv);
        if (!strcmp(cmd, "incremental"))
@@ -145,6 +166,7 @@ int main(int argc, char *argv[])
                return cmd_run(argc, argv);
        if (!strcmp(cmd, "stop"))
                return cmd_stop(argc, argv);
+#endif
 
        if (!strcmp(cmd, "fs"))
                return fs_cmds(argc, argv);
@@ -152,6 +174,9 @@ int main(int argc, char *argv[])
        if (!strcmp(cmd, "device"))
                return device_cmds(argc, argv);
 
+       if (!strcmp(cmd, "data"))
+               return data_cmds(argc, argv);
+
        if (!strcmp(cmd, "unlock"))
                return cmd_unlock(argc, argv);
        if (!strcmp(cmd, "set-passphrase"))