summaryrefslogtreecommitdiff
path: root/fs/f2fs/gc.c
diff options
context:
space:
mode:
authorqixiaoyu1 <qxy65535@gmail.com>2022-07-18 11:28:40 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2022-07-30 20:17:07 -0700
commit1adaa71ea9bff3a0ca0b37eabbb7f89225b595cb (patch)
tree67fc03aeb4d09c47a14f01641bd8356e61f442d2 /fs/f2fs/gc.c
parent0d5b9d8156396bbe1c982708b38ab9e188c45ec9 (diff)
downloadlwn-1adaa71ea9bff3a0ca0b37eabbb7f89225b595cb.tar.gz
lwn-1adaa71ea9bff3a0ca0b37eabbb7f89225b595cb.zip
f2fs: don't bother wait_ms by foreground gc
f2fs_gc returns -EINVAL via f2fs_balance_fs when there is enough free secs after write checkpoint, but with gc_merge enabled, it will cause the sleep time of gc thread to be set to no_gc_sleep_time even if there are many dirty segments can be selected. Signed-off-by: qixiaoyu1 <qixiaoyu1@xiaomi.com> Reviewed-by: Chao Yu <chao@kernel.org> 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, 5 insertions, 2 deletions
diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c
index c38bdaf831af..6da21d405ce1 100644
--- a/fs/f2fs/gc.c
+++ b/fs/f2fs/gc.c
@@ -150,8 +150,11 @@ do_gc:
gc_control.nr_free_secs = foreground ? 1 : 0;
/* if return value is not zero, no victim was selected */
- if (f2fs_gc(sbi, &gc_control))
- wait_ms = gc_th->no_gc_sleep_time;
+ if (f2fs_gc(sbi, &gc_control)) {
+ /* don't bother wait_ms by foreground gc */
+ if (!foreground)
+ wait_ms = gc_th->no_gc_sleep_time;
+ }
if (foreground)
wake_up_all(&gc_th->fggc_wq);