aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAravind Ramesh <aravind.ramesh@wdc.com>2021-06-16 19:25:58 +0000
committerJaegeuk Kim <jaegeuk@kernel.org>2021-06-22 08:09:58 -0700
commite01ad3108120ff1e21abe52cb8b89a135a574ff1 (patch)
tree84748f22f53db05e4d12b833222da8f35c531e0e
parentf3b93bf5b8457a7aeab411afe9e112b7c9bb29bb (diff)
downloadf2fs-tools-e01ad3108120ff1e21abe52cb8b89a135a574ff1.tar.gz
f2fs-tools: fix metadata region overlap with zoned block device zones
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> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--mkfs/f2fs_format.c15
1 files changed, 15 insertions, 0 deletions
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) -