From: Kevin Wolf <kwolf@redhat.com>
To: Manos Pitsidianakis <el13635@mail.ntua.gr>
Cc: qemu-devel <qemu-devel@nongnu.org>,
Stefan Hajnoczi <stefanha@redhat.com>,
Alberto Garcia <berto@igalia.com>,
qemu-block <qemu-block@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 2/3] block: skip implicit nodes in snapshots, blockjobs
Date: Thu, 3 Aug 2017 12:22:13 +0200 [thread overview]
Message-ID: <20170803102213.GE4456@dhcp-200-186.str.redhat.com> (raw)
In-Reply-To: <20170801134907.31253-3-el13635@mail.ntua.gr>
Am 01.08.2017 um 15:49 hat Manos Pitsidianakis geschrieben:
> Implicit filter nodes added at the top of nodes can interfere with block
> jobs. This is not a problem when they are added by other jobs since
> adding another job will issue a QERR_DEVICE_IN_USE, but it can happen in
> the next commit which introduces an implicitly created throttle filter
> node below BlockBackend, which we want to be skipped during automatic
> operations on the graph since the user does not necessarily know about
> their existence.
>
> Signed-off-by: Manos Pitsidianakis <el13635@mail.ntua.gr>
> ---
> block.c | 17 +++++++++++++++++
> blockdev.c | 12 ++++++++++++
> include/block/block_int.h | 2 ++
> 3 files changed, 31 insertions(+)
>
> diff --git a/block.c b/block.c
> index 886a457ab0..9ebdba28b0 100644
> --- a/block.c
> +++ b/block.c
> @@ -4947,3 +4947,20 @@ bool bdrv_can_store_new_dirty_bitmap(BlockDriverState *bs, const char *name,
>
> return drv->bdrv_can_store_new_dirty_bitmap(bs, name, granularity, errp);
> }
> +
> +/* Get first non-implicit node down a bs chain. */
> +BlockDriverState *bdrv_get_first_non_implicit(BlockDriverState *bs)
> +{
> + if (!bs) {
> + return NULL;
> + }
> +
> + if (!bs->implicit) {
> + return bs;
> + }
> +
> + /* at this point bs is implicit and must have a child */
> + assert(bs->file);
> +
> + return bdrv_get_first_non_implicit(bs->file->bs);
> +}
mirror_top/commit_top use bs->backing instead of bs->file, so this
assertion would fail for them.
It's probably better to assert that the implicit node has only one child
and then use that child, whatever it may be.
I'd also prefer the function to work iteratively rather than recursively
because chains can be rather long. (I know that we recurse in many
places anyway, so it's not a strong argument, but I think it would also
look a bit nicer.)
Kevin
next prev parent reply other threads:[~2017-08-03 10:22 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-01 13:49 [Qemu-devel] [PATCH 0/3] block: remove legacy I/O throttling Manos Pitsidianakis
2017-08-01 13:49 ` [Qemu-devel] [PATCH 1/3] block: add options parameter to bdrv_new_open_driver() Manos Pitsidianakis
2017-08-02 9:33 ` Stefan Hajnoczi
2017-08-01 13:49 ` [Qemu-devel] [PATCH 2/3] block: skip implicit nodes in snapshots, blockjobs Manos Pitsidianakis
2017-08-02 9:52 ` Stefan Hajnoczi
2017-08-03 10:22 ` Kevin Wolf [this message]
2017-08-01 13:49 ` [Qemu-devel] [PATCH 3/3] block: remove legacy I/O throttling Manos Pitsidianakis
2017-08-02 10:07 ` Stefan Hajnoczi
2017-08-02 10:33 ` Kevin Wolf
2017-08-02 16:46 ` Manos Pitsidianakis
2017-08-02 10:34 ` Manos Pitsidianakis
2017-08-02 14:36 ` Stefan Hajnoczi
2017-08-03 11:10 ` 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=20170803102213.GE4456@dhcp-200-186.str.redhat.com \
--to=kwolf@redhat.com \
--cc=berto@igalia.com \
--cc=el13635@mail.ntua.gr \
--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).