diff options
author | Sheng Yong <shengyong1@huawei.com> | 2018-05-08 11:51:34 +0200 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2018-05-31 20:31:52 +0200 |
commit | 35a9a766a1b3d57b5f84356954c443db62311b68 (patch) | |
tree | 907d234ee5c47d44374aea38423a14f5b4362f39 | |
parent | f2fs: let discard thread wait a little longer if dev is busy (diff) | |
download | linux-35a9a766a1b3d57b5f84356954c443db62311b68.tar.xz linux-35a9a766a1b3d57b5f84356954c443db62311b68.zip |
f2fs: clear discard_wake earlier
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 <shengyong1@huawei.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r-- | fs/f2fs/segment.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index d61f5ca661ce..bfbf66675ce2 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1402,6 +1402,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)) @@ -1413,9 +1417,6 @@ static int issue_discard_thread(void *data) continue; } - if (dcc->discard_wake) - dcc->discard_wake = 0; - if (sbi->gc_mode == GC_URGENT) __init_discard_policy(sbi, &dpolicy, DPOLICY_FORCE, 1); |