linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
* [f2fs-dev] [PATCH] mkfs.f2fs: adjust zone alignment when using convention partition with zoned one
@ 2024-09-10 13:56 Yohan Joung
  2024-10-28 18:05 ` Daeho Jeong
  0 siblings, 1 reply; 2+ messages in thread
From: Yohan Joung @ 2024-09-10 13:56 UTC (permalink / raw)
  To: jaegeuk, chao; +Cc: linux-kernel, linux-f2fs-devel

When formatting conventional partition with zoned one, we are already
aligning the starting block address of the next device to the zone size.
Therefore, we do not align the segment0 address to the zone alignment.
This reduces the wasted zone_align_start_offset.

Signed-off-by: Yohan Joung <yohan.joung@sk.com>
---
 mkfs/f2fs_format.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/mkfs/f2fs_format.c b/mkfs/f2fs_format.c
index 37d23f3..71f5ec8 100644
--- a/mkfs/f2fs_format.c
+++ b/mkfs/f2fs_format.c
@@ -252,11 +252,19 @@ static int f2fs_prepare_super_block(void)
 
 	set_sb(block_count, c.total_sectors >> log_sectors_per_block);
 
-	zone_align_start_offset =
-		((uint64_t) c.start_sector * DEFAULT_SECTOR_SIZE +
-		2 * F2FS_BLKSIZE + zone_size_bytes - 1) /
-		zone_size_bytes * zone_size_bytes -
-		(uint64_t) c.start_sector * DEFAULT_SECTOR_SIZE;
+	if (c.zoned_mode && c.ndevs > 1) {
+		zone_align_start_offset =
+			((uint64_t) c.start_sector * DEFAULT_SECTOR_SIZE +
+			2 * F2FS_BLKSIZE + segment_size_bytes - 1) /
+			segment_size_bytes * segment_size_bytes -
+			(uint64_t) c.start_sector * DEFAULT_SECTOR_SIZE;
+	} else {
+		zone_align_start_offset =
+			((uint64_t) c.start_sector * DEFAULT_SECTOR_SIZE +
+			2 * F2FS_BLKSIZE + zone_size_bytes - 1) /
+			zone_size_bytes * zone_size_bytes -
+			(uint64_t) c.start_sector * DEFAULT_SECTOR_SIZE;
+	}
 
 	if (c.feature & F2FS_FEATURE_RO)
 		zone_align_start_offset = 8192;
-- 
2.25.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] 2+ messages in thread

end of thread, other threads:[~2024-10-28 18:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-10 13:56 [f2fs-dev] [PATCH] mkfs.f2fs: adjust zone alignment when using convention partition with zoned one Yohan Joung
2024-10-28 18:05 ` Daeho Jeong

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