mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 11:50:43 +09:00
f2fs: reduce cmd_lock coverage in __issue_discard_cmd
__submit_discard_cmd may lead long latency due to exhaustion of I/O request resource in block layer, so issuing all discard under cmd_lock may lead to hangtask, in order to avoid that, let's reduce it's coverage. Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
@@ -1238,14 +1238,14 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
|
|||||||
int i, iter = 0, issued = 0;
|
int i, iter = 0, issued = 0;
|
||||||
bool io_interrupted = false;
|
bool io_interrupted = false;
|
||||||
|
|
||||||
mutex_lock(&dcc->cmd_lock);
|
|
||||||
f2fs_bug_on(sbi,
|
|
||||||
!__check_rb_tree_consistence(sbi, &dcc->root));
|
|
||||||
blk_start_plug(&plug);
|
|
||||||
for (i = MAX_PLIST_NUM - 1; i >= 0; i--) {
|
for (i = MAX_PLIST_NUM - 1; i >= 0; i--) {
|
||||||
if (i + 1 < dpolicy->granularity)
|
if (i + 1 < dpolicy->granularity)
|
||||||
break;
|
break;
|
||||||
pend_list = &dcc->pend_list[i];
|
pend_list = &dcc->pend_list[i];
|
||||||
|
|
||||||
|
mutex_lock(&dcc->cmd_lock);
|
||||||
|
f2fs_bug_on(sbi, !__check_rb_tree_consistence(sbi, &dcc->root));
|
||||||
|
blk_start_plug(&plug);
|
||||||
list_for_each_entry_safe(dc, tmp, pend_list, list) {
|
list_for_each_entry_safe(dc, tmp, pend_list, list) {
|
||||||
f2fs_bug_on(sbi, dc->state != D_PREP);
|
f2fs_bug_on(sbi, dc->state != D_PREP);
|
||||||
|
|
||||||
@@ -1259,12 +1259,14 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi,
|
|||||||
issued++;
|
issued++;
|
||||||
skip:
|
skip:
|
||||||
if (++iter >= dpolicy->max_requests)
|
if (++iter >= dpolicy->max_requests)
|
||||||
goto out;
|
break;
|
||||||
}
|
}
|
||||||
|
blk_finish_plug(&plug);
|
||||||
|
mutex_unlock(&dcc->cmd_lock);
|
||||||
|
|
||||||
|
if (iter >= dpolicy->max_requests)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
out:
|
|
||||||
blk_finish_plug(&plug);
|
|
||||||
mutex_unlock(&dcc->cmd_lock);
|
|
||||||
|
|
||||||
if (!issued && io_interrupted)
|
if (!issued && io_interrupted)
|
||||||
issued = -1;
|
issued = -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user