f2fs-tools: fix metadata region overlap with zoned block device zones
PATCH 1/1 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.
--- mkfs/f2fs_format.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
mkfs/f2fs_format.c +15 -0
@@ -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) -
Signature · 8 lines
2.25.1 _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Hello Kim,
Could you please pull this ?
I will send a v2 if any review comments are there, please let me know.
Thanks,
Aravind
Quoted 50 lines
-----Original Message-----
From: Aravind Ramesh <[email protected]>
Sent: Thursday, June 17, 2021 12:56 AM
To: [email protected]
Cc: [email protected]; Aravind Ramesh <[email protected]>
Subject: [f2fs-dev] [PATCH] f2fs-tools: fix metadata region overlap with zoned block device zonesFor 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 <[email protected]>--- mkfs/f2fs_format.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)mkfs/f2fs_format.c index 3565bd3..2132852 renamed from mkfs/f2fs_format.c +0
-0100644
mkfs/f2fs_format.c +9
-0@@ -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 toosmall,"
mkfs/f2fs_format.c +1
-0+ " (%"PRIu64" MiB needed).\n",c.devices[0].path,
mkfs/f2fs_format.c +5
-1+ (get_sb (main_blkaddr) - + c.devices[i].start_blkaddr) >> 8); +return -1 ; + } + } } total_zones = get_sb(segment_count) / (c.segs_per_zone) - --
Quoted 1 line
2.25.1
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Jaegeuk Kim
AppliedHi,
Quoted 4 lines · Aravind Ramesh
Hello Kim,
Could you please pull this ?
I will send a v2 if any review comments are there, please let me know.
I queued this in -dev which will go into -master later.
Thanks,
Quoted 52 lines
Thanks,
AravindQuoted 48 lines
-----Original Message-----
From: Aravind Ramesh <[email protected]>
Sent: Thursday, June 17, 2021 12:56 AM
To: [email protected]
Cc: [email protected]; Aravind Ramesh <[email protected]>
Subject: [f2fs-dev] [PATCH] f2fs-tools: fix metadata region overlap with zoned block device zonesFor 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 <[email protected]>--- mkfs/f2fs_format.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)mkfs/f2fs_format.c index 3565bd3..2132852 renamed from mkfs/f2fs_format.c +0
-0100644
mkfs/f2fs_format.c +9
-0@@ -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 toosmall,"
mkfs/f2fs_format.c +1
-0+ " (%"PRIu64" MiB needed).\n",c.devices[0].path,
mkfs/f2fs_format.c +5
-0+ (get_sb (main_blkaddr) - + c.devices[i].start_blkaddr) >> 8); +return -1 ; + } + } }
Quoted 3 lines
Quoted 3 lines
total_zones=get_sb(segment_count)/ (c.segs_per_zone) -
--
2.25.1
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Quoted 6 lines
I queued this in -dev which will go into -master later.
https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-
tools.git/commit/?h=dev&id=b750268dafec5a59716b9aec606dc18a9cbdae70
Thank you.
Aravind
Quoted 2 lines
Thanks,
_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel