[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9ab17089-accc-c3a3-a5dc-007fc4eeaa20@kernel.org>
Date: Fri, 3 Sep 2021 07:57:38 +0800
From: Chao Yu <chao@...nel.org>
To: Daeho Jeong <daeho43@...il.com>, linux-kernel@...r.kernel.org,
linux-f2fs-devel@...ts.sourceforge.net, kernel-team@...roid.com
Cc: Daeho Jeong <daehojeong@...gle.com>
Subject: Re: [f2fs-dev] [PATCH v4] f2fs: introduce fragment allocation mode
mount option
On 2021/9/3 1:24, Daeho Jeong wrote:
> @@ -2630,6 +2631,8 @@ static unsigned int __get_next_segno(struct f2fs_sb_info *sbi, int type)
> unsigned short seg_type = curseg->seg_type;
>
> sanity_check_seg_type(sbi, seg_type);
> + if (f2fs_need_rand_seg(sbi))
> + return prandom_u32() % (MAIN_SECS(sbi) * sbi->segs_per_sec);
if (f2fs_need_seq_seg(sbi))
return 0;
static inline bool f2fs_need_seq_seg(struct f2fs_sb_info *sbi)
{
return F2FS_OPTION(sbi).fs_mode == FS_MODE_FRAGMENT_FIXED_BLK;
}
> @@ -2707,12 +2715,29 @@ static int __next_free_blkoff(struct f2fs_sb_info *sbi,
> static void __refresh_next_blkoff(struct f2fs_sb_info *sbi,
> struct curseg_info *seg)
> {
> - if (seg->alloc_type == SSR)
> + if (seg->alloc_type == SSR) {
> seg->next_blkoff =
> __next_free_blkoff(sbi, seg->segno,
> seg->next_blkoff + 1);
> - else
> + } else {
> seg->next_blkoff++;
> + if (F2FS_OPTION(sbi).fs_mode == FS_MODE_FRAGMENT_FIXED_BLK) {
> + if (--seg->fragment_remained_chunk <= 0) {
> + seg->fragment_remained_chunk =
> + sbi->fragment_chunk_size;
> + seg->next_blkoff +=
> + sbi->fragment_hole_size;
One more concern... we'd better to save fragment_remained_hole as well
as fragment_remained_chunk, otherwise, if fragment_chunk_size +
fragment_hole_size > 512, fragment hole will be truncated to 512 -
fragment_chunk_size due to we won't create hole with enough size as
seg->next_blkoff has crossed end of current segment.
Thanks,
Powered by blists - more mailing lists