From: Jeff Cody <jcody@redhat.com>
To: Max Reitz <mreitz@redhat.com>
Cc: kwolf@redhat.com, quintela@redhat.com, qemu-devel@nongnu.org,
qemu-block@nongnu.org, armbru@redhat.com
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH 3/3] block: use bdrv_lookup_bs() over blk_by_name() for BDS only results
Date: Wed, 14 Oct 2015 14:13:03 -0400 [thread overview]
Message-ID: <20151014181303.GA9447@localhost.localdomain> (raw)
In-Reply-To: <561E996E.4040608@redhat.com>
On Wed, Oct 14, 2015 at 08:05:34PM +0200, Max Reitz wrote:
> On 14.10.2015 15:16, Jeff Cody wrote:
> > To find a BlockDriverState interface, it can be done via blk_by_name(),
> > bdrv_find_node(), and bdrv_lookup_bs(). The latter can take the place
> > of the other two, in the instances where we are only concerned with the
> > BlockDriverState.
> >
> > In much of the usage of blk_by_name(), we can simplify the code by
> > calling bdrv_lookup_bs() instead of blk_by_name(), when what we need is
> > just the BDS, and not the BB.
> >
> > Signed-off-by: Jeff Cody <jcody@redhat.com>
> > ---
> > blockdev.c | 84 ++++++++++++++++++++-----------------------------------
> > migration/block.c | 6 ++--
> > 2 files changed, 32 insertions(+), 58 deletions(-)
>
> Again, if this series is based on Berto's blockdev-snapshot series, it
> should be based on my BB series as well. But with that series applied,
> this patch has some (non-trivial) rebase conflicts on it.
>
> Also, it has a fundamental conflict with that series: If a BB can be
> found by bdrv_lookup_bs() but it doesn't have a BDS, it will return NULL
> and set *errp accordingly ("No medium in device"). However, this patch
> discards that error message and just keeps the one of the former
> blk_by_name() caller, which is generally "Device not found". That is
> wrong, however, if there is simply no medium in the device.
>
Good point. We can just drop this patch, then - maybe at some point,
we can have a consolidated API to obtain a BDS (if having such a thing
is even all that important), that fits well with the design goal of
your series.
I think the first two patches are probably worth keeping, however.
> In some cases, that doesn't matter (since we just assume that if there
> is a BB, it will have a BDS, like for hmp_commit), but it most probably
> does matter for all the places which conflict with my BB series, the
> reason being that they generally conflict because I added a
> blk_is_available() check.
>
> Note that this is a "design conflict", too: bdrv_lookup_bs() will return
> NULL only if blk_bs() is NULL. blk_is_available() may return false even
> if there is a BDS (if the BDS is unavailable, e.g. one of the BDSs in
> the tree not being inserted or the guest device's tray is open). But if
> you already have a BDS (because you used bdrv_lookup_bs()), calling
> blk_is_available() on bs->blk afterwards looks kind of strange...
>
> Max
>
prev parent reply other threads:[~2015-10-14 18:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-14 13:15 [Qemu-devel] [PATCH 0/3] Prefer bdrv_lookup_bs() to find BDS nodes Jeff Cody
2015-10-14 13:16 ` [Qemu-devel] [PATCH 1/3] block: Use bdrv_lookup_bs() instead of bdrv_find_node() Jeff Cody
2015-10-14 17:29 ` [Qemu-devel] [Qemu-block] " Max Reitz
2015-10-14 17:34 ` Max Reitz
2015-10-14 17:42 ` Jeff Cody
2015-10-15 12:01 ` [Qemu-devel] " Alberto Garcia
2015-10-16 7:52 ` Markus Armbruster
2015-10-14 13:16 ` [Qemu-devel] [PATCH 2/3] block: make bdrv_find_node() static Jeff Cody
2015-10-14 17:41 ` [Qemu-devel] [Qemu-block] " Max Reitz
2015-10-15 12:01 ` [Qemu-devel] " Alberto Garcia
2015-10-14 13:16 ` [Qemu-devel] [PATCH 3/3] block: use bdrv_lookup_bs() over blk_by_name() for BDS only results Jeff Cody
2015-10-14 18:05 ` [Qemu-devel] [Qemu-block] " Max Reitz
2015-10-14 18:13 ` Jeff Cody [this message]
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=20151014181303.GA9447@localhost.localdomain \
--to=jcody@redhat.com \
--cc=armbru@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=quintela@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.