dm: block_if: io_uring: flush the modified in-core data on demand

When `io_uring` is used, `blockif_flush_cache` is missing when an WRITE
operation is completed. `blockif_flush_cache` would flush the modified
in-core data to the disk device according to the setting of the cache mode.

Tracked-On: #8612

Signed-off-by: Shiqing Gao <shiqing.gao@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
This commit is contained in:
Shiqing Gao 2023-12-30 23:55:26 +08:00 committed by acrnsi-robot
parent 5306d9e7db
commit f92b0f43e6
1 changed files with 6 additions and 1 deletions

View File

@ -1120,6 +1120,7 @@ iou_process_completions(struct blockif_queue *bq)
struct blockif_elem *be;
struct blockif_req *br;
struct io_uring *ring = &bq->ring;
int err = 0;
while (io_uring_peek_cqe(ring, &cqes) == 0) {
if (!cqes) {
@ -1150,8 +1151,12 @@ iou_process_completions(struct blockif_queue *bq)
blockif_deinit_bounce_iov(br);
}
if (be->op == BOP_WRITE) {
err = blockif_flush_cache(bq->bc);
}
be->status = BST_DONE;
(*br->callback)(br, 0);
(*br->callback)(br, err);
blockif_complete(bq, be);
}