diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2018-02-26 09:19:47 -0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2018-03-13 08:05:49 +0900 |
commit | 69babac019337b35aae5644ccf8089243c749d4c (patch) | |
tree | c6d3e1ddb942e6d25a57e95bb1f859b1a1f0d24d /fs/f2fs | |
parent | 846ae671ad368e344a2b141c0f19e1014b27a0dd (diff) | |
download | linux-stable-69babac019337b35aae5644ccf8089243c749d4c.tar.gz linux-stable-69babac019337b35aae5644ccf8089243c749d4c.tar.bz2 linux-stable-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')
-rw-r--r-- | fs/f2fs/gc.c | 7 |
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); |