summaryrefslogtreecommitdiff
path: root/cmd_device.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_device.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_device.c')
-rw-r--r--cmd_device.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/cmd_device.c b/cmd_device.c
index c5d516bf..eadb02bd 100644
--- a/cmd_device.c
+++ b/cmd_device.c
@@ -78,12 +78,10 @@ int cmd_device_add(int argc, char *argv[])
case 'S':
if (bch2_strtoull_h(optarg, &dev_opts.size))
die("invalid filesystem size");
-
- dev_opts.size >>= 9;
break;
case 'B':
- 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 'D':
dev_opts.discard = true;
@@ -121,9 +119,9 @@ int cmd_device_add(int argc, char *argv[])
struct bch_opts fs_opts = bch2_parse_opts(fs_opt_strs);
opt_set(fs_opts, block_size,
- read_file_u64(fs.sysfs_fd, "options/block_size") >> 9);
+ read_file_u64(fs.sysfs_fd, "options/block_size"));
opt_set(fs_opts, btree_node_size,
- read_file_u64(fs.sysfs_fd, "options/btree_node_size") >> 9);
+ read_file_u64(fs.sysfs_fd, "options/btree_node_size"));
struct bch_sb *sb = bch2_format(fs_opt_strs,
fs_opts,