If SBI_NEED_FSCK is set, discard_wake will never be cleared. As a
result, the condition of wait_event_interruptible_timeout() is always
true, which gets discard thread run too frequently.

Signed-off-by: Sheng Yong <shengyo...@huawei.com>
---
 fs/f2fs/segment.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 503a98abdb2f..e53e28fd397e 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1404,6 +1404,10 @@ static int issue_discard_thread(void *data)
                                kthread_should_stop() || freezing(current) ||
                                dcc->discard_wake,
                                msecs_to_jiffies(wait_ms));
+
+               if (dcc->discard_wake)
+                       dcc->discard_wake = 0;
+
                if (try_to_freeze())
                        continue;
                if (f2fs_readonly(sbi->sb))
@@ -1415,9 +1419,6 @@ static int issue_discard_thread(void *data)
                        continue;
                }
 
-               if (dcc->discard_wake)
-                       dcc->discard_wake = 0;
-
                if (sbi->gc_thread && sbi->gc_thread->gc_urgent)
                        init_discard_policy(&dpolicy, DPOLICY_FORCE, 1);
 
-- 
2.17.0


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to