summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSahitya Tummala <stummala@codeaurora.org>2019-06-06 11:38:13 +0200
committerJaegeuk Kim <jaegeuk@kernel.org>2019-07-03 00:40:42 +0200
commit56659ce838456c6f2315ce8a4bd686ac4b23e9d1 (patch)
tree7683e9d77d67bc9bcea258e98c862107ddc0c172 /fs
parentf2fs: add a rw_sem to cover quota flag changes (diff)
downloadlinux-56659ce838456c6f2315ce8a4bd686ac4b23e9d1.tar.xz
linux-56659ce838456c6f2315ce8a4bd686ac4b23e9d1.zip
f2fs: fix is_idle() check for discard type
The discard thread should issue upto dpolicy->max_requests at once and wait for all those discard requests at once it reaches dpolicy->max_requests. It should then sleep for dpolicy->min_interval timeout before issuing the next batch of discard requests. But in the current code of is_idle(), it checks for dcc_info->queued_discard and aborts issuing the discard batch of max_requests. This dcc_info->queued_discard will be true always once one discard command is issued. It is thus resulting into this type of discard request pattern - - Issue discard request#1 - is_idle() returns false, discard thread waits for request#1 and then sleeps for min_interval 50ms. - Issue discard request#2 - is_idle() returns false, discard thread waits for request#2 and then sleeps for min_interval 50ms. - and so on for all other discard requests, assuming f2fs is idle w.r.t other conditions. With this fix, the pattern will look like this - - Issue discard request#1 - Issue discard request#2 and so on upto max_requests of 8 - Issue discard request#8 - wait for min_interval 50ms. Signed-off-by: Sahitya Tummala <stummala@codeaurora.org> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/f2fs/f2fs.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 41a37ffabb8e..761c5a59ef77 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -2227,7 +2227,7 @@ static inline bool is_idle(struct f2fs_sb_info *sbi, int type)
get_pages(sbi, F2FS_DIO_WRITE))
return false;
- if (SM_I(sbi) && SM_I(sbi)->dcc_info &&
+ if (type != DISCARD_TIME && SM_I(sbi) && SM_I(sbi)->dcc_info &&
atomic_read(&SM_I(sbi)->dcc_info->queued_discard))
return false;