Skip to content

Commit

Permalink
f2fs: hurry up to issue discard after io interruption
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
chaseyu authored and Jaegeuk Kim committed Sep 12, 2017
1 parent 80647e5 commit e6c6de1
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions fs/f2fs/segment.c
Original file line number Diff line number Diff line change
Expand Up @@ -1062,6 +1062,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,
Expand All @@ -1083,11 +1084,20 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi, bool issue_cond)
continue;
}

if (!issue_cond || is_idle(sbi)) {
if (!issue_cond) {
__submit_discard_cmd(sbi, dc);
issued++;
continue;
}

if (is_idle(sbi)) {
__submit_discard_cmd(sbi, dc);
issued++;
} else {
io_interrupted = true;
}
if (issue_cond && iter++ > DISCARD_ISSUE_RATE)

if (++iter >= DISCARD_ISSUE_RATE)
goto out;
}
if (list_empty(pend_list) && dcc->pend_list_tag[i] & P_TRIM)
Expand All @@ -1097,6 +1107,9 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi, bool issue_cond)
blk_finish_plug(&plug);
mutex_unlock(&dcc->cmd_lock);

if (!issued && io_interrupted)
issued = -1;

return issued;
}

Expand Down

0 comments on commit e6c6de1

Please sign in to comment.