Commit 522d1711 authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim

f2fs: stop issuing discard immediately if there is queued IO

For background discard policy, even if there is queued user IO, still
we will check max_requests times for next discard entry, it is unneeded,
let's just stop this round submission immediately.
Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 4c6b56c0
...@@ -1188,7 +1188,7 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi, ...@@ -1188,7 +1188,7 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
struct list_head *pend_list; struct list_head *pend_list;
struct discard_cmd *dc, *tmp; struct discard_cmd *dc, *tmp;
struct blk_plug plug; struct blk_plug plug;
int i, iter = 0, issued = 0; int i, issued = 0;
bool io_interrupted = false; bool io_interrupted = false;
for (i = MAX_PLIST_NUM - 1; i >= 0; i--) { for (i = MAX_PLIST_NUM - 1; i >= 0; i--) {
...@@ -1209,20 +1209,19 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi, ...@@ -1209,20 +1209,19 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
if (dpolicy->io_aware && i < dpolicy->io_aware_gran && if (dpolicy->io_aware && i < dpolicy->io_aware_gran &&
!is_idle(sbi)) { !is_idle(sbi)) {
io_interrupted = true; io_interrupted = true;
goto skip; break;
} }
__submit_discard_cmd(sbi, dpolicy, dc); __submit_discard_cmd(sbi, dpolicy, dc);
issued++;
skip: if (++issued >= dpolicy->max_requests)
if (++iter >= dpolicy->max_requests)
break; break;
} }
blk_finish_plug(&plug); blk_finish_plug(&plug);
next: next:
mutex_unlock(&dcc->cmd_lock); mutex_unlock(&dcc->cmd_lock);
if (iter >= dpolicy->max_requests) if (issued >= dpolicy->max_requests || io_interrupted)
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment