From d28cc1643c5a4c74370907b7072b292878a1fb0d Mon Sep 17 00:00:00 2001 From: Park Ju Hyung Date: Sun, 17 Feb 2019 12:33:55 +0900 Subject: [PATCH] f2fs/rapid_gc: do not wait until all invalid blocks are discarded Undiscarded blocks may not reach 0 for various reasons, such as discard granularity settings and discard thread terminating before GC ends, and when that happens, GC thread enters an indefinite loop. Remove this logic entirely. This is not much of an issue since discard thread does not rely on rapid GC. Signed-off-by: Park Ju Hyung Signed-off-by: kdrag0n --- fs/f2fs/gc.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 192e682c99d8..820846d0aa4a 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -50,7 +50,6 @@ static int gc_thread_func(void *data) { struct f2fs_sb_info *sbi = data; struct f2fs_gc_kthread *gc_th = sbi->gc_thread; - struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; wait_queue_head_t *wq = &sbi->gc_thread->gc_wait_queue_head; unsigned int wait_ms = gc_th->min_sleep_time; bool force_gc; @@ -136,15 +135,12 @@ static int gc_thread_func(void *data) /* if return value is not zero, no victim was selected */ if (f2fs_gc(sbi, force_gc || test_opt(sbi, FORCE_FG_GC), true, NULL_SEGNO)) { - /* also wait until all invalid blocks are discarded */ - if (dcc->undiscard_blks == 0) { - wait_ms = gc_th->no_gc_sleep_time; - gc_set_wakelock(sbi, gc_th, false); - gc_th->gc_urgent = 0; - f2fs_msg(sbi->sb, KERN_INFO, - "No more GC victim found, " - "sleeping for %u ms", wait_ms); - } + wait_ms = gc_th->no_gc_sleep_time; + gc_set_wakelock(sbi, gc_th, false); + gc_th->gc_urgent = 0; + f2fs_msg(sbi->sb, KERN_INFO, + "No more GC victim found, " + "sleeping for %u ms", wait_ms); } trace_f2fs_background_gc(sbi->sb, wait_ms,