From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40115) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WgtUT-0008Ex-1B for qemu-devel@nongnu.org; Sun, 04 May 2014 06:17:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WgtUM-0000Cy-TD for qemu-devel@nongnu.org; Sun, 04 May 2014 06:17:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:10425) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WgtUM-0000Cs-Kx for qemu-devel@nongnu.org; Sun, 04 May 2014 06:17:42 -0400 Date: Sun, 4 May 2014 18:17:45 +0800 From: Fam Zheng Message-ID: <20140504101745.GG1124@T430.nay.redhat.com> References: <1398956086-20171-1-git-send-email-stefanha@redhat.com> <1398956086-20171-19-git-send-email-stefanha@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1398956086-20171-19-git-send-email-stefanha@redhat.com> Subject: Re: [Qemu-devel] [PATCH 18/22] vmdk: implement .bdrv_detach/attach_aio_context() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Kevin Wolf , Paolo Bonzini , "Shergill, Gurinder" , "Vinod, Chegu" , qemu-devel@nongnu.org On Thu, 05/01 16:54, 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. > > Cc: Fam Zheng > Signed-off-by: Stefan Hajnoczi > --- > 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, > }; > -- I'm wondering why we need to separate detach and attach as two functions, and also add bdrv_set_aio_context in block.c, instead of a single .bdrv_set_aio_context member which is called in bdrv_set_aio_context()? The latter seems less code. Thanks, Fam