mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
f2fs: avoid victim selection from previous victim section
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: e3080b0120
("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>
This commit is contained in:
parent
78a99fe625
commit
e219aecfd4
1 changed files with 3 additions and 2 deletions
|
@ -1749,8 +1749,9 @@ freed:
|
||||||
get_valid_blocks(sbi, segno, false) == 0)
|
get_valid_blocks(sbi, segno, false) == 0)
|
||||||
seg_freed++;
|
seg_freed++;
|
||||||
|
|
||||||
if (__is_large_section(sbi) && segno + 1 < end_segno)
|
if (__is_large_section(sbi))
|
||||||
sbi->next_victim_seg[gc_type] = segno + 1;
|
sbi->next_victim_seg[gc_type] =
|
||||||
|
(segno + 1 < end_segno) ? segno + 1 : NULL_SEGNO;
|
||||||
skip:
|
skip:
|
||||||
f2fs_put_page(sum_page, 0);
|
f2fs_put_page(sum_page, 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue