mirror of
https://github.com/torvalds/linux.git
synced 2024-11-24 13:11:40 +00:00
f2fs: fix recording invalid last_victim
When doing garbage collection, we try to record segment offset which locates at next one of last victim, using it as the start offset in next searching. But in some corner cases, recorded offset may cross the end of main segment area, it will cause incorrectly searching in dirty_segmap bitmap. This patch adds modular operation to avoid this issue. Reported-by: Yunlei He <heyunlei@huawei.com> Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
8f73cbb7d4
commit
9897159a7b
@ -361,6 +361,7 @@ next:
|
||||
sbi->last_victim[p.gc_mode] = last_victim + 1;
|
||||
else
|
||||
sbi->last_victim[p.gc_mode] = segno + 1;
|
||||
sbi->last_victim[p.gc_mode] %= MAIN_SEGS(sbi);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user