]> git.baikalelectronics.ru Git - kernel.git/commit
f2fs: avoid victim selection from previous victim section
authorYonggil Song <yonggil.song@samsung.com>
Tue, 22 Nov 2022 09:03:20 +0000 (18:03 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:41:20 +0000 (11:41 +0100)
commitc0d4c7058528025d66ed23f99492d20f43276dc3
tree23cb116e8762f272f32508df3cb836897182cf22
parentbbd9d034a5fca6aed220c8e0e41c6a1f4b1f97d6
f2fs: avoid victim selection from previous victim section

[ Upstream commit e219aecfd4b766c4e878a3769057e9809f7fcadc ]

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: afa16fea4b14 ("f2fs: support subsectional garbage collection")
Signed-off-by: Yonggil Song <yonggil.song@samsung.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/f2fs/gc.c