Commit 16c52e65 authored by Sahitya Tummala's avatar Sahitya Tummala
Browse files

f2fs: Fix indefinite loop in f2fs_gc()



Policy - Foreground GC, LFS and greedy GC mode.

Under this policy, f2fs_gc() loops forever to GC as it doesn't have
enough free segements to proceed and thus it keeps calling gc_more
for the same victim segment.  This can happen if the selected victim
segment could not be GC'd due to failed blkaddr validity check i.e.
is_alive() returns false for the blocks set in current validity map.

Fix this by keeping track of such invalid segments and skip those
segments for selection in get_victim_by_default() to avoid endless
GC loop under such error scenarios. Currently, add this logic under
CONFIG_F2FS_CHECK_FS to be able to root cause the issue in debug
version.

Change-Id: I2cffd45d6b53affa0fc8b73469f1d046b9d3a2fb
Signed-off-by: default avatarSahitya Tummala <stummala@codeaurora.org>
Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
[Jaegeuk Kim: fix wrong bitmap size]
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
Git-commit: bbf9f7d90f21e05e31b7cdd95b32f64dd2819dfe
Git-repo: https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git/


[stummala@codeaurora.org: resolve minor merge conflicts]
Signed-off-by: default avatarSahitya Tummala <stummala@codeaurora.org>
parent a1b440b2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment