Skip to content

Commit

Permalink
f2fs: clear discard_wake earlier
Browse files Browse the repository at this point in the history
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>
Signed-off-by: khusika <khusikadhamar@gmail.com>
  • Loading branch information
Sheng Yong authored and khusika committed Aug 9, 2018
1 parent 99c91f0 commit 07c918d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fs/f2fs/segment.c
Original file line number Diff line number Diff line change
Expand Up @@ -1483,6 +1483,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))
Expand All @@ -1494,9 +1498,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);

Expand Down

0 comments on commit 07c918d

Please sign in to comment.