linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Surbhi Palande <f2fsnewbie@gmail.com>
To: linux-f2fs-devel@lists.sourceforge.net
Cc: Surbhi Palande <csurbhi@gmail.com>,
	Jaegeuk Kim <jaegeuk@kernel.org>,
	Damien Le Moal <damien.lemoal@wdc.com>
Subject: [f2fs-dev] [f2fs-tools][PATCH] libf2fs: Throw an error when zone dev info not found
Date: Thu,  1 Aug 2019 19:47:48 -0700	[thread overview]
Message-ID: <20190802024748.17987-1-f2fsnewbie@gmail.com> (raw)
In-Reply-To: <BYAPR04MB581626A599C2601E1A6BFAD4E7DE0@BYAPR04MB5816.namprd04.prod.outlook.com>

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 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/libf2fs.c b/lib/libf2fs.c
index 6b5badf..4966dee 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,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;
-- 
2.20.1



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

  reply	other threads:[~2019-08-02  2:48 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
2019-08-02  2:47   ` Surbhi Palande [this message]
2019-08-02  3:19     ` [f2fs-dev] [f2fs-tools][PATCH] libf2fs: Throw an error when zone dev " 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=20190802024748.17987-1-f2fsnewbie@gmail.com \
    --to=f2fsnewbie@gmail.com \
    --cc=csurbhi@gmail.com \
    --cc=damien.lemoal@wdc.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).