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>
Wed, 5 Sep 2018 22:21:56 +0000 (15:21 -0700)
commitdba8dac99310288025c74f34340b87f124fdca9a
tree61391fa0bbb45aa137738f45ebbad0b36daae341
parent54f3a3a8c3e9b51d968b83fa8aa1932b59f1ffc1
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