summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2010-01-12 13:49:43 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2010-01-13 17:14:15 -0600
commitf8012c135ecb0f410245b3ed0476a5d0a61beb9c (patch)
tree8e90be24f0a71fa3a300a4e9075cfc4bb41dc74e /block
parent3f5075ae63b6dc1de9428d028a4d28fc98e7fdff (diff)
downloadqemu-f8012c135ecb0f410245b3ed0476a5d0a61beb9c.zip
qcow/qcow2: implement bdrv_aio_flush
Now that we do not have to flush the backing device anymore implementing the bdrv_aio_flush method for image formats is trivial. [hch: forward ported to qemu mainline from a product tree] Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'block')
-rw-r--r--block/qcow.c9
-rw-r--r--block/qcow2.c9
2 files changed, 18 insertions, 0 deletions
diff --git a/block/qcow.c b/block/qcow.c
index 7fc85ae588..1e3e59b008 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -900,6 +900,14 @@ static void qcow_flush(BlockDriverState *bs)
bdrv_flush(s->hd);
}
+static BlockDriverAIOCB *qcow_aio_flush(BlockDriverState *bs,
+ BlockDriverCompletionFunc *cb, void *opaque)
+{
+ BDRVQcowState *s = bs->opaque;
+
+ return bdrv_aio_flush(s->hd, cb, opaque);
+}
+
static int qcow_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
{
BDRVQcowState *s = bs->opaque;
@@ -940,6 +948,7 @@ static BlockDriver bdrv_qcow = {
.bdrv_make_empty = qcow_make_empty,
.bdrv_aio_readv = qcow_aio_readv,
.bdrv_aio_writev = qcow_aio_writev,
+ .bdrv_aio_flush = qcow_aio_flush,
.bdrv_write_compressed = qcow_write_compressed,
.bdrv_get_info = qcow_get_info,
diff --git a/block/qcow2.c b/block/qcow2.c
index 4f9ef91715..6622ebadb0 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1111,6 +1111,14 @@ static void qcow_flush(BlockDriverState *bs)
bdrv_flush(s->hd);
}
+static BlockDriverAIOCB *qcow_aio_flush(BlockDriverState *bs,
+ BlockDriverCompletionFunc *cb, void *opaque)
+{
+ BDRVQcowState *s = bs->opaque;
+
+ return bdrv_aio_flush(s->hd, cb, opaque);
+}
+
static int64_t qcow_vm_state_offset(BDRVQcowState *s)
{
return (int64_t)s->l1_vm_state_index << (s->cluster_bits + s->l2_bits);
@@ -1225,6 +1233,7 @@ static BlockDriver bdrv_qcow2 = {
.bdrv_aio_readv = qcow_aio_readv,
.bdrv_aio_writev = qcow_aio_writev,
+ .bdrv_aio_flush = qcow_aio_flush,
.bdrv_write_compressed = qcow_write_compressed,
.bdrv_snapshot_create = qcow2_snapshot_create,