Skip to contentSkip to conversation

xen_disk: use NATIVE_AIO and NOCACHE

GIT PULL New Stefano Stabellini 3 participants 6 messages Mar 27, 2012 – Mar 30, 2012

lore
Share & tools
lore
#0 lore raw

Anthony,
please pull this small patch series that allows xen_disk to be used correctly with NATIVE_AIO and O_DIRECT.

This series should be backported to the stable branch too.

Stefano Stabellini (2):
xen_disk: open disk with BDRV_O_NOCACHE | BDRV_O_CACHE_WB | BDRV_O_NATIVE_AIO
xen_disk: when using AIO flush after the operation is completed

 hw/xen_disk.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

git://xenbits.xen.org/people/sstabellini/qemu-dm.git disk_io

Cheers,

Stefano

#1 lore raw

PATCH 1/2 xen_disk: open disk with BDRV_O_NOCACHE | BDRV_O_CACHE_WB | BDRV_O_NATIVE_AIO

---
 hw/xen_disk.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
hw/xen_disk.c +2 -2
index 68fa36a..0f265a4 100644
@@ -584,10 +584,10 @@ static int blk_init(struct XenDevice *xendev)
     }
 
     /* read-only ? */
+    qflags = BDRV_O_NOCACHE | BDRV_O_CACHE_WB | BDRV_O_NATIVE_AIO;
     if (strcmp(blkdev->mode, "w") == 0) {
-        qflags = BDRV_O_RDWR;
+        qflags |= BDRV_O_RDWR;
     } else {
-        qflags = 0;
         info  |= VDISK_READONLY;
     }
 
Signature · 1 line
1.7.2.5
#2 lore raw

PATCH 2/2 xen_disk: when using AIO flush after the operation is completed

In reply to Stefano Stabellini

If ioreq->postsync call bdrv_flush when the AIO operation is actually completed.

---
 hw/xen_disk.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
hw/xen_disk.c +3 -3
index 0f265a4..9cb0253 100644
@@ -330,6 +330,9 @@ 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);
@@ -376,9 +379,6 @@ static int ioreq_runio_qemu_aio(struct ioreq *ioreq)
         goto err;
     }
 
-    if (ioreq->postsync) {
-        bdrv_flush(blkdev->bs); /* FIXME: aio_flush() ??? */
-    }
     qemu_aio_complete(ioreq, 0);
 
     return 0;
Signature · 1 line
1.7.2.5
#3 lore raw
In reply to Stefano Stabellini
Quoted 5 lines · Stefano Stabellini

Anthony,
please pull this small patch series that allows xen_disk to be used correctly with NATIVE_AIO and O_DIRECT.

This series should be backported to the stable branch too.

Any plans to add BLKIF_OP_FLUSH_DISKCACHE support to xen_disk? Unlike the old bnroken Xen barrier scheme this actually implements pure flushes for fdatasync or blockdevice O_SYNC I/O corectly, and for modern Linux kernels it actually will be quite a bit faster, too.

#4 lore raw
Quoted 11 lines · Christoph Hellwig
Quoted 5 lines · Stefano Stabellini

Anthony,
please pull this small patch series that allows xen_disk to be used correctly with NATIVE_AIO and O_DIRECT.

This series should be backported to the stable branch too.

Any plans to add BLKIF_OP_FLUSH_DISKCACHE support to xen_disk? Unlike the old bnroken Xen barrier scheme this actually implements pure flushes for fdatasync or blockdevice O_SYNC I/O corectly, and for modern Linux kernels it actually will be quite a bit faster, too.

Yeah, that's a good suggestion, it shouldn't be hard either.

#5 lore raw
In reply to Stefano Stabellini
Quoted 5 lines · Stefano Stabellini

Anthony,
please pull this small patch series that allows xen_disk to be used correctly with NATIVE_AIO and O_DIRECT.

This series should be backported to the stable branch too.

Pulled. Thanks.

Regards,

Anthony Liguori

Quoted 15 lines

Stefano Stabellini (2):
xen_disk: open disk with BDRV_O_NOCACHE | BDRV_O_CACHE_WB | BDRV_O_NATIVE_AIO
xen_disk: when using AIO flush after the operation is completed

  hw/xen_disk.c |   10 +++++-----
  1 files changed, 5 insertions(+), 5 deletions(-)

git://xenbits.xen.org/people/sstabellini/qemu-dm.git disk_io

Cheers,

Stefano