struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info;
struct list_head *wait_list = &(dcc->discard_cmd_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, wait_list, list) {
if (blkaddr == NULL_ADDR) {
submit_bio(dc->bio);
atomic_inc(&dcc->submit_discard);
}
- wait_for_completion_io(&dc->wait);
-
- __remove_discard_cmd(sbi, dc);
continue;
}
__remove_discard_cmd(sbi, dc);
}
}
+ blk_finish_plug(&plug);
+
+ /* this comes from f2fs_put_super */
+ if (blkaddr == NULL_ADDR) {
+ 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);
}