diff options
author | Surbhi Palande <csurbhi@gmail.com> | 2019-08-01 19:47:48 -0700 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2019-08-20 11:23:58 -0700 |
commit | fe154d525044b9daa6ccc9e8fbd3cdcf9000adc3 (patch) | |
tree | 3ab16b8e8ea63046819e4594271b82606887e31f | |
parent | 71a93cff40849d4918a17cdb60361697ddb0aad4 (diff) | |
download | f2fs-tools-fe154d525044b9daa6ccc9e8fbd3cdcf9000adc3.tar.gz |
libf2fs: Throw an error when zone dev info not found
When the -m option is specified to format a Zoned device,
do not fall back to the non-zoned mode in case information
about the device is not found.
Explicitly specify this error to the user.
Signed-off-by: Surbhi Palande <csurbhi@gmail.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r-- | lib/libf2fs.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/libf2fs.c b/lib/libf2fs.c index 0536e5c..c247c2b 100644 --- a/lib/libf2fs.c +++ b/lib/libf2fs.c @@ -16,6 +16,7 @@ #include <errno.h> #include <unistd.h> #include <fcntl.h> +#include <libgen.h> #ifdef HAVE_MNTENT_H #include <mntent.h> #endif @@ -1186,7 +1187,11 @@ int f2fs_get_device_info(void) c.segs_per_sec = c.zone_blocks / DEFAULT_BLOCKS_PER_SEGMENT; c.secs_per_zone = 1; } else { - c.zoned_mode = 0; + if(c.zoned_mode != 0) { + MSG(0, "\n Error: %s may not be a zoned block device \n", + c.devices[0].path); + return -1; + } } c.segs_per_zone = c.segs_per_sec * c.secs_per_zone; |