[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CACOAw_xp94tOAeh=yG93Oh+-y95vh+JzHGpqWmJhYUt4obCvUg@mail.gmail.com>
Date: Mon, 28 Oct 2024 11:05:00 -0700
From: Daeho Jeong <daeho43@...il.com>
To: Yohan Joung <jyh429@...il.com>
Cc: jaegeuk@...nel.org, chao@...nel.org, linux-kernel@...r.kernel.org,
linux-f2fs-devel@...ts.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] mkfs.f2fs: adjust zone alignment when using
convention partition with zoned one
On Tue, Sep 10, 2024 at 6:58 AM Yohan Joung <jyh429@...il.com> wrote:
>
> 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@...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;
> + }
How about using a variable like "alignment_bytes" to accommodate both
"segment_size_bytes" and "zone_size_bytes"?
zone_align_start_offset =
((uint64_t) c.start_sector * DEFAULT_SECTOR_SIZE +
2 * F2FS_BLKSIZE + alignment_bytes - 1) /
alignment_bytes * alignment_bytes -
(uint64_t) c.start_sector * DEFAULT_SECTOR_SIZE;
Thanks,
>
> if (c.feature & F2FS_FEATURE_RO)
> zone_align_start_offset = 8192;
> --
> 2.25.1
>
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@...ts.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Powered by blists - more mailing lists