* [RESEND][PATCH] f2fs: avoid victim selection from previous victim section [not found] <CGME20221122090320epcms2p2e5df6f7bb1c2d80ae69fd5e4f84b08be@epcms2p2> @ 2022-11-22 9:03 ` Yonggil Song 2022-11-24 15:09 ` Chao Yu 0 siblings, 1 reply; 2+ messages in thread From: Yonggil Song @ 2022-11-22 9:03 UTC (permalink / raw) To: jaegeuk, chao, linux-f2fs-devel, linux-kernel When f2fs chooses GC victim in large section & LFS mode, next_victim_seg[gc_type] is referenced first. After segment is freed, next_victim_seg[gc_type] has the next segment number. However, next_victim_seg[gc_type] still has the last segment number even after the last segment of section is freed. In this case, when f2fs chooses a victim for the next GC round, the last segment of previous victim section is chosen as a victim. Initialize next_victim_seg[gc_type] to NULL_SEGNO for the last segment in large section. Fixes: e3080b0120a1 ("f2fs: support subsectional garbage collection") Signed-off-by: Yonggil Song <yonggil.song@samsung.com> --- fs/f2fs/gc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 0f967b1e98f2..f1b68eda2235 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -1749,8 +1749,9 @@ static int do_garbage_collect(struct f2fs_sb_info *sbi, get_valid_blocks(sbi, segno, false) == 0) seg_freed++; - if (__is_large_section(sbi) && segno + 1 < end_segno) - sbi->next_victim_seg[gc_type] = segno + 1; + if (__is_large_section(sbi)) + sbi->next_victim_seg[gc_type] = + (segno + 1 < end_segno) ? segno + 1 : NULL_SEGNO; skip: f2fs_put_page(sum_page, 0); } -- 2.34.1 ^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [RESEND][PATCH] f2fs: avoid victim selection from previous victim section 2022-11-22 9:03 ` [RESEND][PATCH] f2fs: avoid victim selection from previous victim section Yonggil Song @ 2022-11-24 15:09 ` Chao Yu 0 siblings, 0 replies; 2+ messages in thread From: Chao Yu @ 2022-11-24 15:09 UTC (permalink / raw) To: yonggil.song, jaegeuk, linux-f2fs-devel, linux-kernel On 2022/11/22 17:03, Yonggil Song wrote: > When f2fs chooses GC victim in large section & LFS mode, > next_victim_seg[gc_type] is referenced first. After segment is freed, > next_victim_seg[gc_type] has the next segment number. > However, next_victim_seg[gc_type] still has the last segment number > even after the last segment of section is freed. In this case, when f2fs > chooses a victim for the next GC round, the last segment of previous victim > section is chosen as a victim. > > Initialize next_victim_seg[gc_type] to NULL_SEGNO for the last segment in > large section. > > Fixes: e3080b0120a1 ("f2fs: support subsectional garbage collection") > Signed-off-by: Yonggil Song <yonggil.song@samsung.com> Reviewed-by: Chao Yu <chao@kernel.org> Thanks, ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-11-24 15:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20221122090320epcms2p2e5df6f7bb1c2d80ae69fd5e4f84b08be@epcms2p2>
2022-11-22 9:03 ` [RESEND][PATCH] f2fs: avoid victim selection from previous victim section Yonggil Song
2022-11-24 15:09 ` Chao Yu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®