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>
This commit is contained in:
parent
603dde3965
commit
c7fd9e2b4a
1 changed files with 16 additions and 3 deletions
|
@ -1142,6 +1142,7 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi, bool issue_cond)
|
|||
struct blk_plug plug;
|
||||
int iter = 0, issued = 0;
|
||||
int i;
|
||||
bool io_interrupted = false;
|
||||
|
||||
mutex_lock(&dcc->cmd_lock);
|
||||
f2fs_bug_on(sbi,
|
||||
|
@ -1163,11 +1164,20 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi, bool issue_cond)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (!issue_cond || is_idle(sbi)) {
|
||||
issued++;
|
||||
if (!issue_cond) {
|
||||
__submit_discard_cmd(sbi, dc);
|
||||
issued++;
|
||||
continue;
|
||||
}
|
||||
if (issue_cond && iter++ > DISCARD_ISSUE_RATE)
|
||||
|
||||
if (is_idle(sbi)) {
|
||||
__submit_discard_cmd(sbi, dc);
|
||||
issued++;
|
||||
} else {
|
||||
io_interrupted = true;
|
||||
}
|
||||
|
||||
if (++iter >= DISCARD_ISSUE_RATE)
|
||||
goto out;
|
||||
}
|
||||
if (list_empty(pend_list) && dcc->pend_list_tag[i] & P_TRIM)
|
||||
|
@ -1177,6 +1187,9 @@ out:
|
|||
blk_finish_plug(&plug);
|
||||
mutex_unlock(&dcc->cmd_lock);
|
||||
|
||||
if (!issued && io_interrupted)
|
||||
issued = -1;
|
||||
|
||||
return issued;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue