summaryrefslogtreecommitdiff
path: root/fs/f2fs/segment.c
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2017-04-05 18:19:49 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2017-04-10 19:48:08 -0700
commitd431413f00319919ed2adac0d58225160bd1d8fb (patch)
tree62c4f978ea07a9abf2fc0d3c420fd8a9b05e1b87 /fs/f2fs/segment.c
parent22d375dd9cc6ee9ff6382487fdd6ca4759af82a9 (diff)
f2fs: introduce f2fs_wait_discard_bios
Split f2fs_wait_discard_bios from f2fs_wait_discard_bio, just for cleanup, no logic change. 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.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 1a5b3e4770d2..a27dd1679991 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -797,13 +797,9 @@ void f2fs_wait_discard_bio(struct f2fs_sb_info *sbi, block_t blkaddr)
struct list_head *pend_list = &(dcc->discard_pend_list);
struct list_head *wait_list = &(dcc->discard_wait_list);
struct discard_cmd *dc, *tmp;
- struct blk_plug plug;
mutex_lock(&dcc->cmd_lock);
- if (blkaddr == NULL_ADDR)
- goto release_discard;
-
list_for_each_entry_safe(dc, tmp, pend_list, list) {
if (dc->lstart <= blkaddr && blkaddr < dc->lstart + dc->len)
__punch_discard_cmd(sbi, dc, blkaddr);
@@ -817,19 +813,30 @@ void f2fs_wait_discard_bio(struct f2fs_sb_info *sbi, block_t blkaddr)
}
}
-release_discard:
- /* this comes from f2fs_put_super */
- if (blkaddr == NULL_ADDR) {
- blk_start_plug(&plug);
- list_for_each_entry_safe(dc, tmp, pend_list, list)
- __submit_discard_cmd(sbi, dc);
- blk_finish_plug(&plug);
+ mutex_unlock(&dcc->cmd_lock);
+}
- list_for_each_entry_safe(dc, tmp, wait_list, list) {
- wait_for_completion_io(&dc->wait);
- __remove_discard_cmd(sbi, dc);
- }
+/* This comes from f2fs_put_super */
+void f2fs_wait_discard_bios(struct f2fs_sb_info *sbi)
+{
+ struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info;
+ struct list_head *pend_list = &(dcc->discard_pend_list);
+ struct list_head *wait_list = &(dcc->discard_wait_list);
+ struct discard_cmd *dc, *tmp;
+ struct blk_plug plug;
+
+ mutex_lock(&dcc->cmd_lock);
+
+ blk_start_plug(&plug);
+ list_for_each_entry_safe(dc, tmp, pend_list, list)
+ __submit_discard_cmd(sbi, dc);
+ blk_finish_plug(&plug);
+
+ list_for_each_entry_safe(dc, tmp, wait_list, list) {
+ wait_for_completion_io(&dc->wait);
+ __remove_discard_cmd(sbi, dc);
}
+
mutex_unlock(&dcc->cmd_lock);
}