qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
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 05/16] block: Convert bs->file to BdrvChild
Date: Tue, 13 Oct 2015 10:59:14 +0200	[thread overview]
Message-ID: <20151013085914.GC4906@noname.str.redhat.com> (raw)
In-Reply-To: <20151013013305.GL11943@localhost.localdomain>

Am 13.10.2015 um 03:33 hat Jeff Cody geschrieben:
> On Fri, Oct 09, 2015 at 02:15:30PM +0200, Kevin Wolf wrote:
> > This patch removes the temporary duplication between bs->file and
> > bs->file_child by converting everything to BdrvChild.
> > 
> > Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> > Reviewed-by: Max Reitz <mreitz@redhat.com>
> > Reviewed-by: Alberto Garcia <berto@igalia.com>
> > Reviewed-by: Fam Zheng <famz@redhat.com>
> > ---
> >  block.c                   | 63 ++++++++++++++++++++++-------------------------
> >  block/blkdebug.c          | 32 +++++++++++++-----------
> >  block/blkverify.c         | 33 ++++++++++++++-----------
> >  block/bochs.c             |  8 +++---
> >  block/cloop.c             | 10 ++++----
> >  block/dmg.c               | 20 +++++++--------
> >  block/io.c                | 50 ++++++++++++++++++-------------------
> >  block/parallels.c         | 38 ++++++++++++++--------------
> >  block/qapi.c              |  2 +-
> >  block/qcow.c              | 42 ++++++++++++++++---------------
> >  block/qcow2-cache.c       | 11 +++++----
> >  block/qcow2-cluster.c     | 38 ++++++++++++++++------------
> >  block/qcow2-refcount.c    | 45 +++++++++++++++++----------------
> >  block/qcow2-snapshot.c    | 30 +++++++++++-----------
> >  block/qcow2.c             | 62 ++++++++++++++++++++++++----------------------
> >  block/qed-table.c         |  4 +--
> >  block/qed.c               | 32 ++++++++++++------------
> >  block/raw_bsd.c           | 40 +++++++++++++++---------------
> >  block/snapshot.c          | 12 ++++-----
> >  block/vdi.c               | 17 +++++++------
> >  block/vhdx-log.c          | 25 ++++++++++---------
> >  block/vhdx.c              | 36 ++++++++++++++-------------
> >  block/vmdk.c              | 27 ++++++++++----------
> >  block/vpc.c               | 34 +++++++++++++------------
> >  include/block/block.h     |  8 +++++-
> >  include/block/block_int.h |  3 +--
> >  26 files changed, 378 insertions(+), 344 deletions(-)
> >
> 
> [snip lots of code]
> 
> > diff --git a/block/blkdebug.c b/block/blkdebug.c
> > index bc247f4..117fce6 100644
> > --- a/block/blkdebug.c
> > +++ b/block/blkdebug.c
> > @@ -427,10 +427,10 @@ static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags,
> >      s->state = 1;
> >  
> >      /* Open the backing file */
> > -    assert(bs->file == NULL);
> > -    ret = bdrv_open_image(&bs->file, qemu_opt_get(opts, "x-image"), options, "image",
> > -                          bs, &child_file, false, &local_err);
> > -    if (ret < 0) {
> > +    bs->file = bdrv_open_child(qemu_opt_get(opts, "x-image"), options, "image",
> > +                               bs, &child_file, false, &local_err);
> > +    if (local_err) {
> > +        ret = -EINVAL;
> >          error_propagate(errp, local_err);
> >          goto out;
> >      }
> > @@ -449,7 +449,7 @@ static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags,
> >      goto out;
> >  
> >  fail_unref:
> > -    bdrv_unref(bs->file);
> > +    bdrv_unref(bs->file->bs);
> 
> 
> Would it be better to use bdrv_unref_child() here?

Good catch, without it the BdrvChild object is leaked here. (And
blkverify already leaks the whole BDS on .bdrv_open failure. I'll send a
separate patch on top of this series for that.)

I'll just fix this (and your coding style points) while merging the
series; unless something major comes up, I'm not going to send another
version.

Kevin

  reply	other threads:[~2015-10-13  8:59 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 [this message]
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
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=20151013085914.GC4906@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).