summaryrefslogtreecommitdiffstats
path: root/fs/f2fs/segment.c
diff options
context:
space:
mode:
authorYunlei He <heyunlei@huawei.com>2018-04-08 15:11:11 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2018-05-31 11:31:51 -0700
commitf9d1dced7583607e066527ee23d804478870d197 (patch)
tree36e93da58dcb37530ddf0c057adf975b81922991 /fs/f2fs/segment.c
parent2ef79ecb5e906d87475d3e0c49b22425499a89f3 (diff)
downloadlinux-f9d1dced7583607e066527ee23d804478870d197.tar.gz
linux-f9d1dced7583607e066527ee23d804478870d197.tar.bz2
linux-f9d1dced7583607e066527ee23d804478870d197.zip
f2fs: let discard thread wait a little longer if dev is busy
This patch modify discard thread wait policy as below: issued io_interrupted wait time(ms) 1. 8 0 50 2. (0,8) 1 50 3. 0 1 500 (dev is busy) 4. 0 0 60000 (no candidates) Signed-off-by: Yunlei He <heyunlei@huawei.com> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/segment.c')
-rw-r--r--fs/f2fs/segment.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index cc2d8f86d1ae..d61f5ca661ce 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -937,6 +937,7 @@ static void __init_discard_policy(struct f2fs_sb_info *sbi,
if (discard_type == DPOLICY_BG) {
dpolicy->min_interval = DEF_MIN_DISCARD_ISSUE_TIME;
+ dpolicy->mid_interval = DEF_MID_DISCARD_ISSUE_TIME;
dpolicy->max_interval = DEF_MAX_DISCARD_ISSUE_TIME;
dpolicy->io_aware = true;
dpolicy->sync = false;
@@ -946,6 +947,7 @@ static void __init_discard_policy(struct f2fs_sb_info *sbi,
}
} else if (discard_type == DPOLICY_FORCE) {
dpolicy->min_interval = DEF_MIN_DISCARD_ISSUE_TIME;
+ dpolicy->mid_interval = DEF_MID_DISCARD_ISSUE_TIME;
dpolicy->max_interval = DEF_MAX_DISCARD_ISSUE_TIME;
dpolicy->io_aware = false;
} else if (discard_type == DPOLICY_FSTRIM) {
@@ -1420,9 +1422,11 @@ static int issue_discard_thread(void *data)
sb_start_intwrite(sbi->sb);
issued = __issue_discard_cmd(sbi, &dpolicy);
- if (issued) {
+ if (issued > 0) {
__wait_all_discard_cmd(sbi, &dpolicy);
wait_ms = dpolicy.min_interval;
+ } else if (issued == -1){
+ wait_ms = dpolicy.mid_interval;
} else {
wait_ms = dpolicy.max_interval;
}