Patchwork xen_disk: use bdrv_aio_flush instead of bdrv_flush

login
register
mail settings
Submitter Stefano Stabellini
Date April 13, 2012, 6:45 p.m.
Message ID <1334342708-30987-1-git-send-email-stefano.stabellini@eu.citrix.com>
Download mbox | patch
Permalink /patch/152381/
State New
Headers show

Comments

Stefano Stabellini - April 13, 2012, 6:45 p.m.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
 hw/xen_disk.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

Patch

diff --git a/hw/xen_disk.c b/hw/xen_disk.c
index 84ca76e..3e4a47b 100644
--- a/hw/xen_disk.c
+++ b/hw/xen_disk.c
@@ -324,9 +324,6 @@  static void qemu_aio_complete(void *opaque, int ret)
     if (ioreq->aio_inflight > 0) {
         return;
     }
-    if (ioreq->postsync) {
-        bdrv_flush(ioreq->blkdev->bs);
-    }
 
     ioreq->status = ioreq->aio_errors ? BLKIF_RSP_ERROR : BLKIF_RSP_OKAY;
     ioreq_unmap(ioreq);
@@ -343,9 +340,9 @@  static int ioreq_runio_qemu_aio(struct ioreq *ioreq)
         goto err_no_map;
     }
 
-    ioreq->aio_inflight++;
     if (ioreq->presync) {
-        bdrv_flush(blkdev->bs); /* FIXME: aio_flush() ??? */
+        ioreq->aio_inflight++;
+        bdrv_aio_flush(ioreq->blkdev->bs, qemu_aio_complete, ioreq);
     }
 
     switch (ioreq->req.operation) {
@@ -372,8 +369,10 @@  static int ioreq_runio_qemu_aio(struct ioreq *ioreq)
         /* unknown operation (shouldn't happen -- parse catches this) */
         goto err;
     }
-
-    qemu_aio_complete(ioreq, 0);
+    if (ioreq->postsync) {
+        ioreq->aio_inflight++;
+        bdrv_aio_flush(ioreq->blkdev->bs, qemu_aio_complete, ioreq);
+    }
 
     return 0;