All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aravind Ramesh <aravind.ramesh@wdc.com>
To: linux-f2fs-devel@lists.sourceforge.net
Cc: jaegeuk@kernel.org
Subject: [f2fs-dev] [PATCH] f2fs-tools: fix metadata region overlap with zoned block device zones
Date: Wed, 16 Jun 2021 19:25:58 +0000	[thread overview]
Message-ID: <20210616192558.1655258-1-aravind.ramesh@wdc.com> (raw)

For a volume using a zoned block device without conventional zones
(e.g. a NVMe ZNS drive), a regular block device must be used to store
metadata so that in-place metadata writes can be executed. The zoned
block device cannot contain any metadata blocks requiring in-place
update (e.g. bitmap blocks). When formatting a volume that contains
host managed zoned block devices, make sure that the conventional device
used to store metadata is large enough to avoid write errors.

Signed-off-by: Aravind Ramesh <aravind.ramesh@wdc.com>
---
 mkfs/f2fs_format.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index 3565bd3..2132852 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -440,6 +440,21 @@ static int f2fs_prepare_super_block(void)
 					main_blkzone);
 			return -1;
 		}
+		/*
+		 * Check if conventional device has enough space
+		 * to accommodate all metadata, zoned device should
+		 * not overlap to metadata area.
+		 */
+		for (i = 1; i < c.ndevs; i++) {
+			if (c.devices[i].zoned_model == F2FS_ZONED_HM &&
+				c.devices[i].start_blkaddr < get_sb(main_blkaddr)) {
+				MSG(0, "\tError: Conventional device %s is too small,"
+					" (%"PRIu64" MiB needed).\n", c.devices[0].path,
+					(get_sb(main_blkaddr) -
+					c.devices[i].start_blkaddr) >> 8);
+				return -1;
+			}
+		}
 	}
 
 	total_zones = get_sb(segment_count) / (c.segs_per_zone) -
-- 
2.25.1



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

             reply	other threads:[~2021-06-16 19:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-16 19:25 Aravind Ramesh [this message]
2021-06-21 19:43 ` [f2fs-dev] [PATCH] f2fs-tools: fix metadata region overlap with zoned block device zones Aravind Ramesh
2021-06-22  0:44   ` Jaegeuk Kim
2021-06-22  2:49     ` Aravind Ramesh

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=20210616192558.1655258-1-aravind.ramesh@wdc.com \
    --to=aravind.ramesh@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.