From: Kevin Wolf <kwolf@redhat.com>
To: Fam Zheng <famz@redhat.com>
Cc: berto@igalia.com, qemu-block@nongnu.org, armbru@redhat.com,
jcody@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com,
stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 05/16] block: Convert bs->file to BdrvChild
Date: Fri, 9 Oct 2015 13:34:36 +0200 [thread overview]
Message-ID: <20151009113436.GC3956@noname.redhat.com> (raw)
In-Reply-To: <20151008102301.GA10388@ad.nay.redhat.com>
Am 08.10.2015 um 12:23 hat Fam Zheng geschrieben:
> On Thu, 10/01 15:13, Kevin Wolf wrote:
> > @@ -1935,6 +1932,11 @@ void bdrv_close(BlockDriverState *bs)
> > bdrv_unref(backing_hd);
> > }
> >
> > + if (bs->file != NULL) {
> > + bdrv_unref_child(bs, bs->file);
> > + bs->file = NULL;
> > + }
> > +
> > QLIST_FOREACH_SAFE(child, &bs->children, next, next) {
> > /* TODO Remove bdrv_unref() from drivers' close function and use
> > * bdrv_unref_child() here */
> > @@ -1946,7 +1948,6 @@ void bdrv_close(BlockDriverState *bs)
> >
> > g_free(bs->opaque);
> > bs->opaque = NULL;
> > - bs->drv = NULL;
> > bs->copy_on_read = 0;
> > bs->backing_file[0] = '\0';
> > bs->backing_format[0] = '\0';
> > @@ -1959,11 +1960,6 @@ void bdrv_close(BlockDriverState *bs)
> > bs->options = NULL;
> > QDECREF(bs->full_open_options);
> > bs->full_open_options = NULL;
> > -
> > - if (bs->file != NULL) {
> > - bdrv_unref(bs->file);
> > - bs->file = NULL;
> > - }
>
> Why do you need to move them up? Changing bdrv_unref to bdrv_unref_child is not
> enough?
I think it conflicted with the foreach loop above. Technically it might
have worked if I left it as bdrv_unref() in its original place because
the loop only calls bdrv_detach_child(), but with the intention of
replacing the detach with an unref I think it makes more sense to do a
proper bdrv_unref_child() before the loop.
> > 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 */
>
> Isn't "backing file" a confusing term for bs->file given that we have
> bs->backing_hd? :)
I guess it is, even though blkdebug doesn't use bs->backing_hd. Feel
free to send a patch.
> > - 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) {
>
> Should we keep the assertion?
The assertion was there to ensure that a new BDS is created instead of
reusing an existing one. bdrv_open_child() always creates a new one.
> > + 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;
> > }
Kevin
next prev parent reply other threads:[~2015-10-09 11:34 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-01 13:13 [Qemu-devel] [PATCH v2 00/16] block: Get rid of bdrv_swap() Kevin Wolf
2015-10-01 13:13 ` [Qemu-devel] [PATCH v2 01/16] block: Introduce BDS.file_child Kevin Wolf
2015-10-01 13:13 ` [Qemu-devel] [PATCH v2 02/16] vmdk: Use BdrvChild instead of BDS for references to extents Kevin Wolf
2015-10-01 13:13 ` [Qemu-devel] [PATCH v2 03/16] blkverify: Convert s->test_file to BdrvChild Kevin Wolf
2015-10-05 12:07 ` Alberto Garcia
2015-10-01 13:13 ` [Qemu-devel] [PATCH v2 04/16] quorum: Convert " Kevin Wolf
2015-10-07 18:16 ` Max Reitz
2015-10-01 13:13 ` [Qemu-devel] [PATCH v2 05/16] block: Convert bs->file " Kevin Wolf
2015-10-02 17:06 ` Max Reitz
2015-10-05 12:31 ` Alberto Garcia
2015-10-08 10:23 ` Fam Zheng
2015-10-09 11:34 ` Kevin Wolf [this message]
2015-10-01 13:13 ` [Qemu-devel] [PATCH v2 06/16] block: Remove bdrv_open_image() Kevin Wolf
2015-10-01 13:13 ` [Qemu-devel] [PATCH v2 07/16] block: Convert bs->backing_hd to BdrvChild Kevin Wolf
2015-10-02 17:14 ` Max Reitz
2015-10-05 12:59 ` Alberto Garcia
2015-10-09 1:39 ` Fam Zheng
2015-10-09 11:36 ` Kevin Wolf
2015-10-01 13:13 ` [Qemu-devel] [PATCH v2 08/16] block: Manage backing file references in bdrv_set_backing_hd() Kevin Wolf
2015-10-02 17:18 ` Max Reitz
2015-10-05 13:31 ` Alberto Garcia
2015-10-09 1:49 ` Fam Zheng
2015-10-01 13:13 ` [Qemu-devel] [PATCH v2 09/16] block: Split bdrv_move_feature_fields() Kevin Wolf
2015-10-01 13:13 ` [Qemu-devel] [PATCH v2 10/16] block/io: Make bdrv_requests_pending() public Kevin Wolf
2015-10-01 13:13 ` [Qemu-devel] [PATCH v2 11/16] block-backend: Add blk_set_bs() Kevin Wolf
2015-10-02 17:21 ` Max Reitz
2015-10-05 13:33 ` Alberto Garcia
2015-10-01 13:13 ` [Qemu-devel] [PATCH v2 12/16] block: Introduce parents list Kevin Wolf
2015-10-01 13:13 ` [Qemu-devel] [PATCH v2 13/16] block: Implement bdrv_append() without bdrv_swap() Kevin Wolf
2015-10-02 17:32 ` Max Reitz
2015-10-09 14:54 ` Stefan Hajnoczi
2015-10-01 13:13 ` [Qemu-devel] [PATCH v2 14/16] blockjob: Store device name at job creation Kevin Wolf
2015-10-02 17:44 ` Max Reitz
2015-10-06 13:10 ` Alberto Garcia
2015-10-01 13:13 ` [Qemu-devel] [PATCH v2 15/16] block: Add and use bdrv_replace_in_backing_chain() Kevin Wolf
2015-10-01 13:13 ` [Qemu-devel] [PATCH v2 16/16] block: Remove bdrv_swap() Kevin Wolf
2015-10-09 2:10 ` [Qemu-devel] [PATCH v2 00/16] block: Get rid of bdrv_swap() Fam Zheng
2015-10-09 14:56 ` Stefan Hajnoczi
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=20151009113436.GC3956@noname.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.