[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/2] aio: use Linux AIO even if nocache is not speci
From: |
Frediano Ziglio |
Subject: |
[Qemu-devel] [PATCH 2/2] aio: use Linux AIO even if nocache is not specified |
Date: |
Wed, 27 Jul 2011 20:25:26 +0200 |
Currently Linux AIO are used only if nocache is specified.
Linux AIO works in all cases. The only problem is that currently Linux AIO
does not align data so I add a test that use POSIX AIO in this case.
Signed-off-by: Frediano Ziglio <address@hidden>
---
block/raw-posix.c | 23 ++++++++++-------------
1 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/block/raw-posix.c b/block/raw-posix.c
index 27ae81e..078a256 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -236,21 +236,16 @@ static int raw_open_common(BlockDriverState *bs, const
char *filename,
}
#ifdef CONFIG_LINUX_AIO
- if ((bdrv_flags & (BDRV_O_NOCACHE|BDRV_O_NATIVE_AIO)) ==
- (BDRV_O_NOCACHE|BDRV_O_NATIVE_AIO)) {
+ s->use_aio = 0;
+ if ((bdrv_flags & BDRV_O_NATIVE_AIO)) {
s->aio_ctx = laio_init();
if (!s->aio_ctx) {
goto out_free_buf;
}
s->use_aio = 1;
- } else
-#endif
- {
-#ifdef CONFIG_LINUX_AIO
- s->use_aio = 0;
-#endif
}
+#endif
#ifdef CONFIG_XFS
if (platform_test_xfs_fd(s->fd)) {
@@ -592,14 +587,16 @@ static BlockDriverAIOCB *raw_aio_submit(BlockDriverState
*bs,
if (s->aligned_buf) {
if (!qiov_is_aligned(bs, qiov)) {
type |= QEMU_AIO_MISALIGNED;
-#ifdef CONFIG_LINUX_AIO
- } else if (s->use_aio) {
- return laio_submit(bs, s->aio_ctx, s->fd, sector_num, qiov,
- nb_sectors, cb, opaque, type);
-#endif
}
}
+#ifdef CONFIG_LINUX_AIO
+ if (s->use_aio && !(type & QEMU_AIO_MISALIGNED)) {
+ return laio_submit(bs, s->aio_ctx, s->fd, sector_num, qiov,
+ nb_sectors, cb, opaque, type);
+ }
+#endif
+
return paio_submit(bs, s->fd, sector_num, qiov, nb_sectors,
cb, opaque, type);
}
--
1.7.1
- [Qemu-devel] [PATCH 0/2] improve Linux AIO support, Frediano Ziglio, 2011/07/27
- [Qemu-devel] [PATCH 1/2] linux aio: support flush operation, Frediano Ziglio, 2011/07/27
- Re: [Qemu-devel] [PATCH 1/2] linux aio: support flush operation, Christoph Hellwig, 2011/07/27
- Re: [Qemu-devel] [PATCH 1/2] linux aio: support flush operation, Frediano Ziglio, 2011/07/27
- Re: [Qemu-devel] [PATCH 1/2] linux aio: support flush operation, Christoph Hellwig, 2011/07/27
- Re: [Qemu-devel] [PATCH 1/2] linux aio: support flush operation, Kevin Wolf, 2011/07/28
- Re: [Qemu-devel] [PATCH 1/2] linux aio: support flush operation, Christoph Hellwig, 2011/07/28
- Re: [Qemu-devel] [PATCH 1/2] linux aio: support flush operation, Kevin Wolf, 2011/07/28
- Re: [Qemu-devel] [PATCH 1/2] linux aio: support flush operation, Christoph Hellwig, 2011/07/29
- Re: [Qemu-devel] [PATCH 1/2] linux aio: support flush operation, Stefan Hajnoczi, 2011/07/29
[Qemu-devel] [PATCH 2/2] aio: use Linux AIO even if nocache is not specified,
Frediano Ziglio <=