From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46514) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zlv00-0002YP-Qp for qemu-devel@nongnu.org; Tue, 13 Oct 2015 04:31:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zluzz-0004LR-Id for qemu-devel@nongnu.org; Tue, 13 Oct 2015 04:31:56 -0400 Date: Tue, 13 Oct 2015 10:31:47 +0200 From: Kevin Wolf Message-ID: <20151013083147.GA4906@noname.str.redhat.com> References: <1444392941-28704-1-git-send-email-kwolf@redhat.com> <1444392941-28704-8-git-send-email-kwolf@redhat.com> <20151013015313.GN11943@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151013015313.GN11943@localhost.localdomain> Subject: Re: [Qemu-devel] [PATCH v3 07/16] block: Convert bs->backing_hd to BdrvChild List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jeff Cody Cc: berto@igalia.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, armbru@redhat.com, stefanha@redhat.com, famz@redhat.com, mreitz@redhat.com Am 13.10.2015 um 03:53 hat Jeff Cody geschrieben: > On Fri, Oct 09, 2015 at 02:15:32PM +0200, Kevin Wolf wrote: > > This is the final step in converting all of the BlockDriverState > > pointers that block drivers use to BdrvChild. > > > > After this patch, bs->children contains the full list of child nodes > > that are referenced by a given BDS, and these children are only > > referenced through BdrvChild, so that updating the pointer in there is > > enough for changing edges in the graph. > > > > Signed-off-by: Kevin Wolf > > --- > > block.c | 105 +++++++++++++++++++++++----------------------- > > block/io.c | 24 +++++------ > > block/mirror.c | 6 +-- > > block/qapi.c | 8 ++-- > > block/qcow.c | 4 +- > > block/qcow2-cluster.c | 4 +- > > block/qcow2.c | 6 +-- > > block/qed.c | 12 +++--- > > block/stream.c | 8 ++-- > > block/vmdk.c | 21 +++++----- > > block/vvfat.c | 6 +-- > > blockdev.c | 4 +- > > include/block/block_int.h | 12 ++++-- > > qemu-img.c | 4 +- > > 14 files changed, 115 insertions(+), 109 deletions(-) > > > > [...] > > > diff --git a/include/block/block_int.h b/include/block/block_int.h > > index 98936c9..90971c0 100644 > > --- a/include/block/block_int.h > > +++ b/include/block/block_int.h > > @@ -378,8 +378,7 @@ struct BlockDriverState { > > QDict *full_open_options; > > char exact_filename[PATH_MAX]; > > > > - BlockDriverState *backing_hd; > > - BdrvChild *backing_child; > > + BdrvChild *backing; > > BdrvChild *file; > > > > NotifierList close_notifiers; > > @@ -458,6 +457,11 @@ struct BlockDriverState { > > NotifierWithReturn write_threshold_notifier; > > }; > > > > +static inline BlockDriverState *backing_bs(BlockDriverState *bs) > > +{ > > + return bs->backing ? bs->backing->bs : NULL; > > +} > > + > > Is there a good guideline regarding when you prefer backing_bs() to be > used, over accessing bs->backing->bs directly? There seems to be a > lot of mixed usage left in this patch, and I'm not sure if I am just > missing the intended distinction. Essentially, I'm using backing_bs() whenever bs->backing could be NULL, because bs->backing->bs would segfault then. When I know that it's not NULL, I prefer the direct access. Kevin