]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - cmd_format.c
cmd_device: add missing short options to usage
[bcachefs-tools-debian] / cmd_format.c
index fff2d77bb813d85009788923b848d342f7899f0d..75efd5215757223e8ff674bc19378549f0fac251 100644 (file)
 
 #define OPTS                                                                   \
 t("bcachefs format - create a new bcachefs filesystem on one or more devices") \
-t("Usage: bcachefs format [OPTION]... <devices>")                                      \
+t("Usage: bcachefs format [OPTION]... <devices>")                              \
 t("")                                                                          \
 x('b', block_size,             "size",                 NULL)                   \
 x(0,   btree_node_size,        "size",                 "Default 256k")         \
 x(0,   metadata_checksum_type, "(none|crc32c|crc64)",  NULL)                   \
 x(0,   data_checksum_type,     "(none|crc32c|crc64)",  NULL)                   \
 x(0,   compression_type,       "(none|lz4|gzip)",      NULL)                   \
+x(0,   background_compression_type,    "(none|lz4|gzip)",      NULL)           \
 x(0,   replicas,               "#",                    NULL)                   \
 x(0,   data_replicas,          "#",                    NULL)                   \
 x(0,   metadata_replicas,      "#",                    NULL)                   \
 x(0,   foreground_target,      "target",               NULL)                   \
 x(0,   background_target,      "target",               NULL)                   \
-x(0,   promote_target, "target",               NULL)                   \
+x(0,   promote_target,         "target",               NULL)                   \
 x(0,   encrypted,              NULL,                   "Enable whole filesystem encryption (chacha20/poly1305)")\
 x(0,   no_passphrase,          NULL,                   "Don't encrypt master encryption key")\
 x('e', error_action,           "(continue|remount-ro|panic)", NULL)            \
@@ -56,6 +57,7 @@ x(0,  bucket_size,            "size",                 "Bucket size")          \
 x('g', group,                  "label",                "Disk group")\
 x(0,   discard,                NULL,                   NULL)                   \
 x(0,   data_allowed,           "journal,btree,data",   "Allowed types of data on this device")\
+x(0,   durability,             "#",                    "Number of times data written to this device will have been considered replicated")\
 t("Device specific options must come before corresponding devices, e.g.")      \
 t("  bcachefs format --group cache /dev/sdb --tier 1 /dev/sdc")                        \
 t("")                                                                          \
@@ -78,7 +80,8 @@ static void usage(void)
             "      --btree_node=size       Btree node size, default 256k\n"
             "      --metadata_checksum_type=(none|crc32c|crc64)\n"
             "      --data_checksum_type=(none|crc32c|crc64)\n"
-            "      --compression_type=(none|lz4|gzip)\n"
+            "      --compression_type=(none|lz4|gzip|zstd)\n"
+            "      --background_compression_type=(none|lz4|gzip|zstd)\n"
             "      --data_replicas=#       Number of data replicas\n"
             "      --metadata_replicas=#   Number of metadata replicas\n"
             "      --replicas=#            Sets both data and metadata replicas\n"
@@ -94,6 +97,7 @@ static void usage(void)
             "      --fs_size=size          Size of filesystem on device\n"
             "      --bucket=size           Bucket size\n"
             "      --discard               Enable discards\n"
+            "      --durability=#          Device durability (0-4)\n"
             "  -g, --group=label           Disk group\n"
             "\n"
             "  -q, --quiet                 Only print errors\n"
@@ -178,6 +182,12 @@ int cmd_format(int argc, char *argv[])
                                                bch2_compression_types,
                                                "compression type");
                        break;
+               case O_background_compression_type:
+                       opts.background_compression_type =
+                               read_string_list_or_die(optarg,
+                                               bch2_compression_types,
+                                               "compression type");
+                       break;
                case O_data_replicas:
                        if (kstrtouint(optarg, 10, &opts.data_replicas) ||
                            !opts.data_replicas ||
@@ -253,6 +263,11 @@ int cmd_format(int argc, char *argv[])
                                read_flag_list_or_die(optarg,
                                        bch2_data_types, "data type");
                        break;
+               case O_durability:
+                       if (kstrtouint(optarg, 10, &dev_opts.durability) ||
+                           dev_opts.durability > BCH_REPLICAS_MAX)
+                               die("invalid durability");
+                       break;
                case O_no_opt:
                        dev_opts.path = strdup(optarg);
                        darray_append(devices, dev_opts);