summaryrefslogtreecommitdiff
path: root/cmd_format.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2018-03-13 03:23:27 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2018-03-13 03:23:27 -0400
commit6aabc97dc9c895cb1bb2423c84c7131bff7dd6c1 (patch)
tree8dd7d9ced909b8f86c50a96ab50684684c9d2b58 /cmd_format.c
parent35d3f92ad57eae226e255817131fa02605aac1b5 (diff)
Add --durability to format
Diffstat (limited to 'cmd_format.c')
-rw-r--r--cmd_format.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/cmd_format.c b/cmd_format.c
index 065efd9d..75efd521 100644
--- a/cmd_format.c
+++ b/cmd_format.c
@@ -57,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("") \
@@ -96,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"
@@ -261,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);