diff options
author | Hunter Shaffer <huntershaffer182456@gmail.com> | 2023-08-29 18:05:09 -0400 |
---|---|---|
committer | Hunter Shaffer <huntershaffer182456@gmail.com> | 2023-10-08 21:06:07 -0400 |
commit | 9f98746bfcd5159307237f7a491fd79db02d8bf3 (patch) | |
tree | 10af18e18b44adf4cb8456d254aa5e2c44df9216 /cmd_device.c | |
parent | b2ffa12074f1a6060b715e0891c1efb3ee64be68 (diff) |
Change open_for_format to the block io api
Upcoming patch will add device benchmarking at format time, which needs
the bio API.
Signed-off-by: Hunter Shaffer <huntershaffer182456@gmail.com>
Diffstat (limited to 'cmd_device.c')
-rw-r--r-- | cmd_device.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cmd_device.c b/cmd_device.c index 3d67e3ed..1cb31ab8 100644 --- a/cmd_device.c +++ b/cmd_device.c @@ -113,7 +113,9 @@ int cmd_device_add(int argc, char *argv[]) struct bchfs_handle fs = bcache_fs_open(fs_path); - dev_opts.fd = open_for_format(dev_opts.path, force); + int ret = open_for_format(&dev_opts, force); + if (ret) + die("Error opening %s: %s", dev_opts.path, strerror(-ret)); struct bch_opt_strs fs_opt_strs; memset(&fs_opt_strs, 0, sizeof(fs_opt_strs)); @@ -130,8 +132,8 @@ int cmd_device_add(int argc, char *argv[]) format_opts, &dev_opts, 1); free(sb); - fsync(dev_opts.fd); - close(dev_opts.fd); + fsync(dev_opts.bdev->bd_buffered_fd); + close(dev_opts.bdev->bd_buffered_fd); bchu_disk_add(fs, dev_opts.path); return 0; |