diff options
author | Chao Yu <yuchao0@huawei.com> | 2018-07-08 22:08:09 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2018-08-01 11:52:36 -0700 |
commit | 522d1711d62c4fb87d7468ea1ef76ef5c510fd6e (patch) | |
tree | e7781f7e83f47896e52b1426de673f333aedeb75 /fs/f2fs/segment.c | |
parent | 4c6b56c002caf0b3a9aaaeb493c59d53daeaff40 (diff) | |
download | linux-522d1711d62c4fb87d7468ea1ef76ef5c510fd6e.tar.bz2 |
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: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/segment.c')
-rw-r--r-- | fs/f2fs/segment.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 199a77a9c4a9..478a2a87d491 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1188,7 +1188,7 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi, struct list_head *pend_list; struct discard_cmd *dc, *tmp; struct blk_plug plug; - int i, iter = 0, issued = 0; + int i, issued = 0; bool io_interrupted = false; for (i = MAX_PLIST_NUM - 1; i >= 0; i--) { @@ -1209,20 +1209,19 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi, if (dpolicy->io_aware && i < dpolicy->io_aware_gran && !is_idle(sbi)) { io_interrupted = true; - goto skip; + break; } __submit_discard_cmd(sbi, dpolicy, dc); - issued++; -skip: - if (++iter >= dpolicy->max_requests) + + if (++issued >= dpolicy->max_requests) break; } blk_finish_plug(&plug); next: mutex_unlock(&dcc->cmd_lock); - if (iter >= dpolicy->max_requests) + if (issued >= dpolicy->max_requests || io_interrupted) break; } |