aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2017-09-12 09:35:12 -0400
committerJaegeuk Kim <jaegeuk@kernel.org>2017-09-12 13:02:55 -0400
commite6c6de18f010d9a7d592f4044d2c30213cb3a7bc (patch)
tree304c15717533f9c851288b300c8b72804a6467a2
parent80647e5f4c728ecea7d9190c6e7163755ff6835c (diff)
f2fs: hurry up to issue discard after io interruption
Once we encounter I/O interruption during issuing discards, we will delay long time before next round, but if system status is I/O idle during the time, it may loses opportunity to issue discards. So this patch changes to hurry up to issue discard after io interruption. Besides, this patch also fixes to issue discards accurately with assigned rate. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--fs/f2fs/segment.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 7fd742f747ce..dedf0209d820 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1062,6 +1062,7 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi, bool issue_cond)
1062 struct blk_plug plug; 1062 struct blk_plug plug;
1063 int iter = 0, issued = 0; 1063 int iter = 0, issued = 0;
1064 int i; 1064 int i;
1065 bool io_interrupted = false;
1065 1066
1066 mutex_lock(&dcc->cmd_lock); 1067 mutex_lock(&dcc->cmd_lock);
1067 f2fs_bug_on(sbi, 1068 f2fs_bug_on(sbi,
@@ -1083,11 +1084,20 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi, bool issue_cond)
1083 continue; 1084 continue;
1084 } 1085 }
1085 1086
1086 if (!issue_cond || is_idle(sbi)) { 1087 if (!issue_cond) {
1088 __submit_discard_cmd(sbi, dc);
1087 issued++; 1089 issued++;
1090 continue;
1091 }
1092
1093 if (is_idle(sbi)) {
1088 __submit_discard_cmd(sbi, dc); 1094 __submit_discard_cmd(sbi, dc);
1095 issued++;
1096 } else {
1097 io_interrupted = true;
1089 } 1098 }
1090 if (issue_cond && iter++ > DISCARD_ISSUE_RATE) 1099
1100 if (++iter >= DISCARD_ISSUE_RATE)
1091 goto out; 1101 goto out;
1092 } 1102 }
1093 if (list_empty(pend_list) && dcc->pend_list_tag[i] & P_TRIM) 1103 if (list_empty(pend_list) && dcc->pend_list_tag[i] & P_TRIM)
@@ -1097,6 +1107,9 @@ out:
1097 blk_finish_plug(&plug); 1107 blk_finish_plug(&plug);
1098 mutex_unlock(&dcc->cmd_lock); 1108 mutex_unlock(&dcc->cmd_lock);
1099 1109
1110 if (!issued && io_interrupted)
1111 issued = -1;
1112
1100 return issued; 1113 return issued;
1101} 1114}
1102 1115