summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/gc.c
diff options
context:
space:
mode:
authorJaegeuk Kim <jaegeuk@kernel.org>2018-02-26 18:19:47 +0100
committerJaegeuk Kim <jaegeuk@kernel.org>2018-03-13 00:05:49 +0100
commit69babac019337b35aae5644ccf8089243c749d4c (patch)
treec6d3e1ddb942e6d25a57e95bb1f859b1a1f0d24d /fs/f2fs/gc.c
parentf2fs: expose extension_list sysfs entry (diff)
downloadlinux-69babac019337b35aae5644ccf8089243c749d4c.tar.xz
linux-69babac019337b35aae5644ccf8089243c749d4c.zip
f2fs: don't stop GC if GC is contended
Let's do GC as much as possible, while gc_urgent is set. Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/gc.c')
-rw-r--r--fs/f2fs/gc.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index b9d93fd532a9..bc9420ce2275 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -76,14 +76,15 @@ static int gc_thread_func(void *data)
* invalidated soon after by user update or deletion.
* So, I'd like to wait some time to collect dirty segments.
*/
- if (!mutex_trylock(&sbi->gc_mutex))
- goto next;
-
if (gc_th->gc_urgent) {
wait_ms = gc_th->urgent_sleep_time;
+ mutex_lock(&sbi->gc_mutex);
goto do_gc;
}
+ if (!mutex_trylock(&sbi->gc_mutex))
+ goto next;
+
if (!is_idle(sbi)) {
increase_sleep_time(gc_th, &wait_ms);
mutex_unlock(&sbi->gc_mutex);