OSDN Git Service

f2fs: avoid fi->i_gc_rwsem[WRITE] lock in f2fs_gc
authorJaegeuk Kim <jaegeuk@kernel.org>
Wed, 25 Jul 2018 03:11:56 +0000 (12:11 +0900)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 18 Sep 2018 21:42:39 +0000 (14:42 -0700)
commit163bbf811962f0a99bc82ac1e6f35e73509758ca
tree86c9a86f9a8d4601925047774a42499e8bcbf0ad
parent1e1ba6365e040b7929828299cf6c950275abd8bc
f2fs: avoid fi->i_gc_rwsem[WRITE] lock in f2fs_gc

The f2fs_gc() called by f2fs_balance_fs() requires to be called outside of
fi->i_gc_rwsem[WRITE], since f2fs_gc() can try to grab it in a loop.

If it hits the miximum retrials in GC, let's give a chance to release
gc_mutex for a short time in order not to go into live lock in the worst
case.

Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/data.c
fs/f2fs/f2fs.h
fs/f2fs/file.c
fs/f2fs/gc.c
fs/f2fs/segment.c
fs/f2fs/segment.h