From c75f3bdf46f74c9f1c199ace3d2b291e430dcda3 Mon Sep 17 00:00:00 2001 From: Stefan Hajnoczi Date: Thu, 8 May 2014 16:34:54 +0200 Subject: vmdk: implement .bdrv_detach/attach_aio_context() Implement .bdrv_detach/attach_aio_context() interfaces to propagate detach/attach to BDRVVmdkState->extents[].file. The block layer takes care of ->file and ->backing_hd but doesn't know about our extents BlockDriverStates, which is also part of the graph. Reviewed-by: Fam Zheng Signed-off-by: Stefan Hajnoczi --- block/vmdk.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'block') diff --git a/block/vmdk.c b/block/vmdk.c index 2b38f61fcd..b8a476278a 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -2096,6 +2096,27 @@ static int vmdk_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) return 0; } +static void vmdk_detach_aio_context(BlockDriverState *bs) +{ + BDRVVmdkState *s = bs->opaque; + int i; + + for (i = 0; i < s->num_extents; i++) { + bdrv_detach_aio_context(s->extents[i].file); + } +} + +static void vmdk_attach_aio_context(BlockDriverState *bs, + AioContext *new_context) +{ + BDRVVmdkState *s = bs->opaque; + int i; + + for (i = 0; i < s->num_extents; i++) { + bdrv_attach_aio_context(s->extents[i].file, new_context); + } +} + static QEMUOptionParameter vmdk_create_options[] = { { .name = BLOCK_OPT_SIZE, @@ -2153,6 +2174,8 @@ static BlockDriver bdrv_vmdk = { .bdrv_get_specific_info = vmdk_get_specific_info, .bdrv_refresh_limits = vmdk_refresh_limits, .bdrv_get_info = vmdk_get_info, + .bdrv_detach_aio_context = vmdk_detach_aio_context, + .bdrv_attach_aio_context = vmdk_attach_aio_context, .create_options = vmdk_create_options, }; -- cgit v1.2.3-55-g7522