From 8b94ff85737062876c03e7506abb500521c749b9 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 20 Oct 2011 13:16:24 +0200 Subject: block: change flush to co_flush Since coroutine operation is now mandatory, convert all bdrv_flush implementations to coroutines. For qcow2, this means taking the lock. Other implementations are simpler and just forward bdrv_flush to the underlying protocol, so they can avoid the lock. The bdrv_flush callback is then unused and can be eliminated. Signed-off-by: Paolo Bonzini Signed-off-by: Kevin Wolf --- block/qcow.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'block/qcow.c') diff --git a/block/qcow.c b/block/qcow.c index f93e3eb0d9..ab36b2995c 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -781,10 +781,9 @@ static int qcow_write_compressed(BlockDriverState *bs, int64_t sector_num, return 0; } -static BlockDriverAIOCB *qcow_aio_flush(BlockDriverState *bs, - BlockDriverCompletionFunc *cb, void *opaque) +static coroutine_fn int qcow_co_flush(BlockDriverState *bs) { - return bdrv_aio_flush(bs->file, cb, opaque); + return bdrv_co_flush(bs->file); } static int qcow_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) @@ -824,9 +823,9 @@ static BlockDriver bdrv_qcow = { .bdrv_is_allocated = qcow_is_allocated, .bdrv_set_key = qcow_set_key, .bdrv_make_empty = qcow_make_empty, - .bdrv_co_readv = qcow_co_readv, - .bdrv_co_writev = qcow_co_writev, - .bdrv_aio_flush = qcow_aio_flush, + .bdrv_co_readv = qcow_co_readv, + .bdrv_co_writev = qcow_co_writev, + .bdrv_co_flush = qcow_co_flush, .bdrv_write_compressed = qcow_write_compressed, .bdrv_get_info = qcow_get_info, -- cgit v1.2.1