From: Kevin Wolf <kwolf@redhat.com>
To: Jeff Cody <jcody@redhat.com>
Cc: berto@igalia.com, qemu-block@nongnu.org, qemu-devel@nongnu.org,
armbru@redhat.com, stefanha@redhat.com, famz@redhat.com,
mreitz@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3 07/16] block: Convert bs->backing_hd to BdrvChild
Date: Tue, 13 Oct 2015 10:31:47 +0200 [thread overview]
Message-ID: <20151013083147.GA4906@noname.str.redhat.com> (raw)
In-Reply-To: <20151013015313.GN11943@localhost.localdomain>
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 <kwolf@redhat.com>
> > ---
> > 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
next prev parent reply other threads:[~2015-10-13 8:31 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-09 12:15 [Qemu-devel] [PATCH v3 00/16] block: Get rid of bdrv_swap() Kevin Wolf
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 01/16] block: Introduce BDS.file_child Kevin Wolf
2015-10-13 0:43 ` Jeff Cody
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 02/16] vmdk: Use BdrvChild instead of BDS for references to extents Kevin Wolf
2015-10-13 0:55 ` Jeff Cody
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 03/16] blkverify: Convert s->test_file to BdrvChild Kevin Wolf
2015-10-13 0:57 ` Jeff Cody
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 04/16] quorum: Convert " Kevin Wolf
2015-10-13 0:58 ` Jeff Cody
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 05/16] block: Convert bs->file " Kevin Wolf
2015-10-13 1:33 ` Jeff Cody
2015-10-13 8:59 ` Kevin Wolf
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 06/16] block: Remove bdrv_open_image() Kevin Wolf
2015-10-13 1:33 ` Jeff Cody
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 07/16] block: Convert bs->backing_hd to BdrvChild Kevin Wolf
2015-10-12 13:07 ` Alberto Garcia
2015-10-12 16:55 ` Max Reitz
2015-10-13 1:53 ` Jeff Cody
2015-10-13 8:31 ` Kevin Wolf [this message]
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 08/16] block: Manage backing file references in bdrv_set_backing_hd() Kevin Wolf
2015-10-12 13:29 ` Alberto Garcia
2015-10-12 17:13 ` Max Reitz
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 09/16] block: Split bdrv_move_feature_fields() Kevin Wolf
2015-10-12 13:47 ` Alberto Garcia
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 10/16] block/io: Make bdrv_requests_pending() public Kevin Wolf
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 11/16] block-backend: Add blk_set_bs() Kevin Wolf
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 12/16] block: Introduce parents list Kevin Wolf
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 13/16] block: Implement bdrv_append() without bdrv_swap() Kevin Wolf
2015-10-12 14:27 ` Alberto Garcia
2015-10-13 8:39 ` Kevin Wolf
2015-10-13 9:01 ` Alberto Garcia
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 14/16] blockjob: Store device name at job creation Kevin Wolf
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 15/16] block: Add and use bdrv_replace_in_backing_chain() Kevin Wolf
2015-10-09 12:15 ` [Qemu-devel] [PATCH v3 16/16] block: Remove bdrv_swap() Kevin Wolf
2015-10-13 10:25 ` [Qemu-devel] [PATCH v3 00/16] block: Get rid of bdrv_swap() Stefan Hajnoczi
2015-10-13 11:18 ` Kevin Wolf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151013083147.GA4906@noname.str.redhat.com \
--to=kwolf@redhat.com \
--cc=armbru@redhat.com \
--cc=berto@igalia.com \
--cc=famz@redhat.com \
--cc=jcody@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).