diff options
Diffstat (limited to 'block')
-rw-r--r-- | block/raw-posix-aio.h | 3 | ||||
-rw-r--r-- | block/raw-posix.c | 17 |
2 files changed, 19 insertions, 1 deletions
diff --git a/block/raw-posix-aio.h b/block/raw-posix-aio.h index 244bc8b798..a2d4348ee2 100644 --- a/block/raw-posix-aio.h +++ b/block/raw-posix-aio.h @@ -17,8 +17,9 @@ #define QEMU_AIO_READ 0x0001 #define QEMU_AIO_WRITE 0x0002 #define QEMU_AIO_IOCTL 0x0004 +#define QEMU_AIO_FLUSH 0x0008 #define QEMU_AIO_TYPE_MASK \ - (QEMU_AIO_READ|QEMU_AIO_WRITE|QEMU_AIO_IOCTL) + (QEMU_AIO_READ|QEMU_AIO_WRITE|QEMU_AIO_IOCTL|QEMU_AIO_FLUSH) /* AIO flags */ #define QEMU_AIO_MISALIGNED 0x1000 diff --git a/block/raw-posix.c b/block/raw-posix.c index 2ebc88f004..f612340fa4 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -574,6 +574,18 @@ static BlockDriverAIOCB *raw_aio_writev(BlockDriverState *bs, cb, opaque, QEMU_AIO_WRITE); } +static BlockDriverAIOCB *raw_aio_flush(BlockDriverState *bs, + BlockDriverCompletionFunc *cb, void *opaque) +{ + BDRVRawState *s = bs->opaque; + + if (fd_open(bs) < 0) + return NULL; + + return paio_submit(bs, s->aio_ctx, s->fd, 0, NULL, 0, + cb, opaque, QEMU_AIO_FLUSH); +} + static void raw_close(BlockDriverState *bs) { BDRVRawState *s = bs->opaque; @@ -749,6 +761,7 @@ static BlockDriver bdrv_raw = { .bdrv_aio_readv = raw_aio_readv, .bdrv_aio_writev = raw_aio_writev, + .bdrv_aio_flush = raw_aio_flush, .bdrv_truncate = raw_truncate, .bdrv_getlength = raw_getlength, @@ -1002,6 +1015,7 @@ static BlockDriver bdrv_host_device = { .bdrv_aio_readv = raw_aio_readv, .bdrv_aio_writev = raw_aio_writev, + .bdrv_aio_flush = raw_aio_flush, .bdrv_read = raw_read, .bdrv_write = raw_write, @@ -1096,6 +1110,7 @@ static BlockDriver bdrv_host_floppy = { .bdrv_aio_readv = raw_aio_readv, .bdrv_aio_writev = raw_aio_writev, + .bdrv_aio_flush = raw_aio_flush, .bdrv_read = raw_read, .bdrv_write = raw_write, @@ -1176,6 +1191,7 @@ static BlockDriver bdrv_host_cdrom = { .bdrv_aio_readv = raw_aio_readv, .bdrv_aio_writev = raw_aio_writev, + .bdrv_aio_flush = raw_aio_flush, .bdrv_read = raw_read, .bdrv_write = raw_write, @@ -1295,6 +1311,7 @@ static BlockDriver bdrv_host_cdrom = { .bdrv_aio_readv = raw_aio_readv, .bdrv_aio_writev = raw_aio_writev, + .bdrv_aio_flush = raw_aio_flush, .bdrv_read = raw_read, .bdrv_write = raw_write, |