Skip to content

Commit e6c6de1

Browse files
chaseyuJaegeuk Kim
authored andcommitted
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 <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent 80647e5 commit e6c6de1

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

fs/f2fs/segment.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,7 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi, bool issue_cond)
10621062
struct blk_plug plug;
10631063
int iter = 0, issued = 0;
10641064
int i;
1065+
bool io_interrupted = false;
10651066

10661067
mutex_lock(&dcc->cmd_lock);
10671068
f2fs_bug_on(sbi,
@@ -1083,11 +1084,20 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi, bool issue_cond)
10831084
continue;
10841085
}
10851086

1086-
if (!issue_cond || is_idle(sbi)) {
1087+
if (!issue_cond) {
1088+
__submit_discard_cmd(sbi, dc);
10871089
issued++;
1090+
continue;
1091+
}
1092+
1093+
if (is_idle(sbi)) {
10881094
__submit_discard_cmd(sbi, dc);
1095+
issued++;
1096+
} else {
1097+
io_interrupted = true;
10891098
}
1090-
if (issue_cond && iter++ > DISCARD_ISSUE_RATE)
1099+
1100+
if (++iter >= DISCARD_ISSUE_RATE)
10911101
goto out;
10921102
}
10931103
if (list_empty(pend_list) && dcc->pend_list_tag[i] & P_TRIM)
@@ -1097,6 +1107,9 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi, bool issue_cond)
10971107
blk_finish_plug(&plug);
10981108
mutex_unlock(&dcc->cmd_lock);
10991109

1110+
if (!issued && io_interrupted)
1111+
issued = -1;
1112+
11001113
return issued;
11011114
}
11021115

0 commit comments

Comments
 (0)