From: Damien Le Moal <Damien.LeMoal@wdc.com>
To: Surbhi Palande <f2fsnewbie@gmail.com>,
"linux-f2fs-devel@lists.sourceforge.net"
<linux-f2fs-devel@lists.sourceforge.net>
Cc: Surbhi Palande <csurbhi@gmail.com>, Jaegeuk Kim <jaegeuk@kernel.org>
Subject: Re: [f2fs-dev] [f2fs-tools][PATCH] Throw an error when zone device info not found
Date: Thu, 1 Aug 2019 02:56:37 +0000 [thread overview]
Message-ID: <BYAPR04MB581626A599C2601E1A6BFAD4E7DE0@BYAPR04MB5816.namprd04.prod.outlook.com> (raw)
In-Reply-To: 20190801012617.2472-1-f2fsnewbie@gmail.com
On 2019/08/01 10:26, Surbhi Palande wrote:
> From: Surbhi Palande <csurbhi@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 <csurbhi@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
next prev parent reply other threads:[~2019-08-01 2:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-01 1:26 [f2fs-dev] [f2fs-tools][PATCH] Throw an error when zone device info not found Surbhi Palande
2019-08-01 1:47 ` Chao Yu
2019-08-01 2:56 ` Damien Le Moal [this message]
2019-08-02 2:47 ` [f2fs-dev] [f2fs-tools][PATCH] libf2fs: Throw an error when zone dev " Surbhi Palande
2019-08-02 3:19 ` Damien Le Moal
2019-08-02 3:42 ` Chao Yu
[not found] ` <CAMBkX3cF9aQ28rJ2XYZRjfyYXNWBREmc9nZqgqMtimM2eHsEXQ@mail.gmail.com>
2019-08-02 3:32 ` [f2fs-dev] [f2fs-tools][PATCH] Throw an error when zone device " Damien Le Moal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BYAPR04MB581626A599C2601E1A6BFAD4E7DE0@BYAPR04MB5816.namprd04.prod.outlook.com \
--to=damien.lemoal@wdc.com \
--cc=csurbhi@gmail.com \
--cc=f2fsnewbie@gmail.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).