Message ID | 1399559698-31900-22-git-send-email-stefanha@redhat.com |
---|---|
State | New |
Headers | show |
On Thu, 05/08 16:34, Stefan Hajnoczi wrote: > 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> > --- Noticed this doesn't apply any more due to recent VMDK fixes, because the context is different. Trivial to fix, though. > block/vmdk.c | 23 +++++++++++++++++++++++ > 1 file changed, 23 insertions(+) > > diff --git a/block/vmdk.c b/block/vmdk.c > index 06a1f9f..1ca944a 100644 > --- a/block/vmdk.c > +++ b/block/vmdk.c > @@ -2063,6 +2063,27 @@ static ImageInfoSpecific *vmdk_get_specific_info(BlockDriverState *bs) > return spec_info; > } > > +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, > @@ -2118,6 +2139,8 @@ static BlockDriver bdrv_vmdk = { > .bdrv_has_zero_init = vmdk_has_zero_init, > .bdrv_get_specific_info = vmdk_get_specific_info, > .bdrv_refresh_limits = vmdk_refresh_limits, > + .bdrv_detach_aio_context = vmdk_detach_aio_context, > + .bdrv_attach_aio_context = vmdk_attach_aio_context, > > .create_options = vmdk_create_options, > }; > -- > 1.9.0 > >
On Thu, May 15, 2014 at 09:34:20AM +0800, Fam Zheng wrote: > On Thu, 05/08 16:34, Stefan Hajnoczi wrote: > > 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> > > --- > > Noticed this doesn't apply any more due to recent VMDK fixes, because the > context is different. Trivial to fix, though. Yep, me too. The resolution is trivial though. Stefan
diff --git a/block/vmdk.c b/block/vmdk.c index 06a1f9f..1ca944a 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -2063,6 +2063,27 @@ static ImageInfoSpecific *vmdk_get_specific_info(BlockDriverState *bs) return spec_info; } +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, @@ -2118,6 +2139,8 @@ static BlockDriver bdrv_vmdk = { .bdrv_has_zero_init = vmdk_has_zero_init, .bdrv_get_specific_info = vmdk_get_specific_info, .bdrv_refresh_limits = vmdk_refresh_limits, + .bdrv_detach_aio_context = vmdk_detach_aio_context, + .bdrv_attach_aio_context = vmdk_attach_aio_context, .create_options = vmdk_create_options, };