]> 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)
commitb4854562680bb93c73e361ec863a65fdb1748641
tree23cb116e8762f272f32508df3cb836897182cf22
parent3593cd623d4e06844e5936f449e31e143f882326
f2fs: avoid victim selection from previous victim section

[ Upstream commit 3fa9cfbf3bfbb519fe8e7b7df1df4a3327f648a4 ]

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: 9ec6ea70528e ("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