@@ -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;
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(-)