qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 1/2] linux aio: support flush operation


From: Frediano Ziglio
Subject: [Qemu-devel] [PATCH 1/2] linux aio: support flush operation
Date: Wed, 27 Jul 2011 20:25:25 +0200

Signed-off-by: Frediano Ziglio <address@hidden>
---
 block/raw-posix.c |    7 +++++++
 linux-aio.c       |    3 +++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/block/raw-posix.c b/block/raw-posix.c
index 3c6bd4b..27ae81e 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -628,6 +628,13 @@ static BlockDriverAIOCB *raw_aio_flush(BlockDriverState 
*bs,
     if (fd_open(bs) < 0)
         return NULL;
 
+#ifdef CONFIG_LINUX_AIO
+    if (s->use_aio) {
+        return laio_submit(bs, s->aio_ctx, s->fd, 0, NULL,
+                           0, cb, opaque, QEMU_AIO_FLUSH);
+    }
+#endif
+
     return paio_submit(bs, s->fd, 0, NULL, 0, cb, opaque, QEMU_AIO_FLUSH);
 }
 
diff --git a/linux-aio.c b/linux-aio.c
index 68f4b3d..d07c435 100644
--- a/linux-aio.c
+++ b/linux-aio.c
@@ -215,6 +215,9 @@ BlockDriverAIOCB *laio_submit(BlockDriverState *bs, void 
*aio_ctx, int fd,
     case QEMU_AIO_READ:
         io_prep_preadv(iocbs, fd, qiov->iov, qiov->niov, offset);
        break;
+    case QEMU_AIO_FLUSH:
+        io_prep_fdsync(iocbs, fd);
+        break;
     default:
         fprintf(stderr, "%s: invalid AIO request type 0x%x.\n",
                         __func__, type);
-- 
1.7.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]