summaryrefslogtreecommitdiff
path: root/cmd_format.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2017-12-02 06:04:16 -0500
committerKent Overstreet <kent.overstreet@gmail.com>2017-12-02 06:04:16 -0500
commita95883db43e701d45df47af310e4589b5352b798 (patch)
tree624a70f148ffe892c82c52dfe6b895e1a793cd2d /cmd_format.c
parent22291ae84a029d65334d1a90b67b5031f45cd540 (diff)
add --replicas
Diffstat (limited to 'cmd_format.c')
-rw-r--r--cmd_format.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/cmd_format.c b/cmd_format.c
index fbe75d08..9cc56a5f 100644
--- a/cmd_format.c
+++ b/cmd_format.c
@@ -37,6 +37,7 @@ 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, replicas, "#", NULL) \
x(0, data_replicas, "#", NULL) \
x(0, metadata_replicas, "#", NULL) \
x(0, encrypted, NULL, "Enable whole filesystem encryption (chacha20/poly1305)")\
@@ -77,6 +78,7 @@ static void usage(void)
" --compression_type=(none|lz4|gzip)\n"
" --data_replicas=# Number of data replicas\n"
" --metadata_replicas=# Number of metadata replicas\n"
+ " --replicas=# Sets both data and metadata replicas\n"
" --encrypted Enable whole filesystem encryption (chacha20/poly1305)\n"
" --no_passphrase Don't encrypt master encryption key\n"
" --error_action=(continue|readonly|panic)\n"
@@ -175,14 +177,20 @@ int cmd_format(int argc, char *argv[])
break;
case O_data_replicas:
if (kstrtouint(optarg, 10, &opts.data_replicas) ||
- dev_opts.tier >= BCH_REPLICAS_MAX)
+ opts.data_replicas >= BCH_REPLICAS_MAX)
die("invalid replicas");
break;
case O_metadata_replicas:
if (kstrtouint(optarg, 10, &opts.meta_replicas) ||
- dev_opts.tier >= BCH_REPLICAS_MAX)
+ opts.meta_replicas >= BCH_REPLICAS_MAX)
die("invalid replicas");
break;
+ case O_replicas:
+ if (kstrtouint(optarg, 10, &opts.data_replicas) ||
+ opts.data_replicas >= BCH_REPLICAS_MAX)
+ die("invalid replicas");
+ opts.meta_replicas = opts.data_replicas;
+ break;
case O_encrypted:
opts.encrypted = true;
break;