f2fs: fix the periodic wakeups of discard thread
authorSahitya Tummala <stummala@codeaurora.org>
Tue, 6 Apr 2021 09:09:16 +0000 (14:39 +0530)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 6 Apr 2021 14:18:31 +0000 (07:18 -0700)
commitc35b8d5e757e0fd0144890b7b536f7b756f3a648
tree9b7a950e86129243c01993afc4b17aa6adf55e30
parent25ae837e61dee712b4b1df36602ebfe724b2a0b6
f2fs: fix the periodic wakeups of discard thread

Fix the unnecessary periodic wakeups of discard thread that happens under
below two conditions -

1. When f2fs is heavily utilized over 80%, the current discard policy
sets the max sleep timeout of discard thread as 50ms
(DEF_MIN_DISCARD_ISSUE_TIME). But this is set even when there are
no pending discard commands to be issued.

2. In the issue_discard_thread() path when there are no pending discard
commands, it fails to reset the wait_ms to max timeout value.

Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/segment.c