summaryrefslogtreecommitdiff
path: root/cmd_format.c
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2021-12-28 16:47:44 -0500
committerKent Overstreet <kent.overstreet@gmail.com>2022-01-01 21:14:22 -0500
commit9cc3b7debbe27955d480f35f0d7aa8a97c51c3af (patch)
treede7515857db1bd2db4b9c3a32022bfaf15f1fb01 /cmd_format.c
parent38f8daa2b17627488c51f2e0c150213bd1636e00 (diff)
Unit handling cleanups
The option code has been switching to keeping things in display units - bytes - and this transitions more libbcachefs.c code to bytes as well, to match, and also fixes device add. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'cmd_format.c')
-rw-r--r--cmd_format.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/cmd_format.c b/cmd_format.c
index 2c610af2..cc16b31f 100644
--- a/cmd_format.c
+++ b/cmd_format.c
@@ -163,8 +163,6 @@ int cmd_format(int argc, char *argv[])
case O_fs_size:
if (bch2_strtoull_h(optarg, &dev_opts.size))
die("invalid filesystem size");
-
- dev_opts.size >>= 9;
break;
case O_superblock_size:
if (bch2_strtouint_h(optarg, &opts.superblock_size))
@@ -173,8 +171,8 @@ int cmd_format(int argc, char *argv[])
opts.superblock_size >>= 9;
break;
case O_bucket_size:
- dev_opts.bucket_size =
- hatoi_validate(optarg, "bucket size");
+ if (bch2_strtoull_h(optarg, &dev_opts.bucket_size))
+ die("bad bucket_size %s", optarg);
break;
case O_label:
case 'l':
@@ -258,7 +256,7 @@ int cmd_format(int argc, char *argv[])
darray_size(device_paths),
bch2_opts_empty());
if (IS_ERR(c))
- die("error opening %s: %s", device_paths.item,
+ die("error opening %s: %s", device_paths.item[0],
strerror(-PTR_ERR(c)));
bch2_fs_stop(c);