On 2019/08/01 10:26, Surbhi Palande wrote:
> From: Surbhi Palande <csur...@gmail.com>
> 
> 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 <csur...@gmail.com>
> ---
>  lib/libf2fs.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/libf2fs.c b/lib/libf2fs.c
> index 6b5badf..2ea405e 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
> @@ -1140,7 +1141,12 @@ 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 is not zoned (-m option)", 
> c.devices[0].path);

May be spell out "is not a zoned block device" to be clear ?

> +                     MSG(1, "\n /sys/block/%s/queue/zoned not found \n",
> +                                     basename(c.devices[0].path));

If this file does not exist, then the kernel is simply too old. It does not
necessarily mean that the device is not a zoned block device. It simply mean
that the device type cannot be determined. And if "zoned" file exist and says
"none", this message would be confusing. So maybe remove it ?

> +                     return -1;
> +             }
>       }
>  
>       c.segs_per_zone = c.segs_per_sec * c.secs_per_zone;
> 

-- 
Damien Le Moal
Western Digital Research


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to