|
@@ -558,8 +558,27 @@ int f2fs_issue_flush(struct f2fs_sb_info *sbi)
|
|
|
wait_for_completion(&cmd.wait);
|
|
|
atomic_dec(&fcc->issing_flush);
|
|
|
} else {
|
|
|
- llist_del_all(&fcc->issue_list);
|
|
|
- atomic_set(&fcc->issing_flush, 0);
|
|
|
+ struct llist_node *list;
|
|
|
+
|
|
|
+ list = llist_del_all(&fcc->issue_list);
|
|
|
+ if (!list) {
|
|
|
+ wait_for_completion(&cmd.wait);
|
|
|
+ atomic_dec(&fcc->issing_flush);
|
|
|
+ } else {
|
|
|
+ struct flush_cmd *tmp, *next;
|
|
|
+
|
|
|
+ ret = submit_flush_wait(sbi);
|
|
|
+
|
|
|
+ llist_for_each_entry_safe(tmp, next, list, llnode) {
|
|
|
+ if (tmp == &cmd) {
|
|
|
+ cmd.ret = ret;
|
|
|
+ atomic_dec(&fcc->issing_flush);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ tmp->ret = ret;
|
|
|
+ complete(&tmp->wait);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return cmd.ret;
|