linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [f2fs-tools][PATCH] Throw an error when zone device info not found
@ 2019-08-01  1:26 Surbhi Palande
  2019-08-01  1:47 ` Chao Yu
  2019-08-01  2:56 ` Damien Le Moal
  0 siblings, 2 replies; 7+ messages in thread
From: Surbhi Palande @ 2019-08-01  1:26 UTC (permalink / raw)
  To: linux-f2fs-devel; +Cc: Surbhi Palande, Jaegeuk Kim, Damien Le Moal

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);
+			MSG(1, "\n /sys/block/%s/queue/zoned not found \n",
+					basename(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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-08-02  3:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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   ` [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

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).