aboutsummaryrefslogtreecommitdiff
path: root/block/vmdk.c
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2014-05-08 16:34:54 +0200
committerStefan Hajnoczi <stefanha@redhat.com>2014-06-04 09:56:12 +0200
commitc75f3bdf46f74c9f1c199ace3d2b291e430dcda3 (patch)
tree8f6c5e241c9c49bf44eba983a1a7e73d344d9ec4 /block/vmdk.c
parent2af0b2005669ee3572a19499c51a499114a8ec50 (diff)
downloadqemu-c75f3bdf46f74c9f1c199ace3d2b291e430dcda3.zip
qemu-c75f3bdf46f74c9f1c199ace3d2b291e430dcda3.tar.gz
qemu-c75f3bdf46f74c9f1c199ace3d2b291e430dcda3.tar.bz2
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 <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block/vmdk.c')
-rw-r--r--block/vmdk.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/block/vmdk.c b/block/vmdk.c
index 2b38f61..b8a4762 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,
};