From: Kevin Wolf <kwolf@redhat.com>
To: Max Reitz <mreitz@redhat.com>
Cc: Alberto Garcia <berto@igalia.com>,
qemu-block@nongnu.org, qemu-devel@nongnu.org,
Paolo Bonzini <pbonzini@redhat.com>, Fam Zheng <famz@redhat.com>,
John Snow <jsnow@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v8 12/16] blockdev: Keep track of monitor-owned BDS
Date: Fri, 29 Jan 2016 14:49:47 +0100 [thread overview]
Message-ID: <20160129134947.GC4356@noname.redhat.com> (raw)
In-Reply-To: <56AB6CB8.8000905@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 3240 bytes --]
Am 29.01.2016 um 14:44 hat Max Reitz geschrieben:
> On 28.01.2016 04:33, Fam Zheng wrote:
> > On Wed, 01/27 18:59, Max Reitz wrote:
> >> Signed-off-by: Max Reitz <mreitz@redhat.com>
> >> ---
> >> blockdev.c | 26 ++++++++++++++++++++++++++
> >> include/block/block_int.h | 4 ++++
> >> stubs/Makefile.objs | 1 +
> >> stubs/blockdev-close-all-bdrv-states.c | 5 +++++
> >> 4 files changed, 36 insertions(+)
> >> create mode 100644 stubs/blockdev-close-all-bdrv-states.c
> >>
> >> diff --git a/blockdev.c b/blockdev.c
> >> index 09d4621..ac93f43 100644
> >> --- a/blockdev.c
> >> +++ b/blockdev.c
> >> @@ -50,6 +50,9 @@
> >> #include "trace.h"
> >> #include "sysemu/arch_init.h"
> >>
> >> +static QTAILQ_HEAD(, BlockDriverState) monitor_bdrv_states =
> >> + QTAILQ_HEAD_INITIALIZER(monitor_bdrv_states);
> >> +
> >> static const char *const if_name[IF_COUNT] = {
> >> [IF_NONE] = "none",
> >> [IF_IDE] = "ide",
> >> @@ -702,6 +705,19 @@ fail:
> >> return NULL;
> >> }
> >>
> >> +void blockdev_close_all_bdrv_states(void)
> >> +{
> >> + BlockDriverState *bs, *next_bs;
> >> +
> >> + QTAILQ_FOREACH_SAFE(bs, &monitor_bdrv_states, monitor_list, next_bs) {
> >> + AioContext *ctx = bdrv_get_aio_context(bs);
> >> +
> >> + aio_context_acquire(ctx);
> >> + bdrv_unref(bs);
> >> + aio_context_release(ctx);
> >> + }
> >> +}
> >> +
> >> static void qemu_opt_rename(QemuOpts *opts, const char *from, const char *to,
> >> Error **errp)
> >> {
> >> @@ -3875,12 +3891,15 @@ void qmp_blockdev_add(BlockdevOptions *options, Error **errp)
> >> if (!bs) {
> >> goto fail;
> >> }
> >> +
> >> + QTAILQ_INSERT_TAIL(&monitor_bdrv_states, bs, monitor_list);
> >> }
> >>
> >> if (bs && bdrv_key_required(bs)) {
> >> if (blk) {
> >> blk_unref(blk);
> >> } else {
> >> + QTAILQ_REMOVE(&monitor_bdrv_states, bs, monitor_list);
> >> bdrv_unref(bs);
> >> }
> >> error_setg(errp, "blockdev-add doesn't support encrypted devices");
> >> @@ -3945,11 +3964,18 @@ void qmp_x_blockdev_del(bool has_id, const char *id,
> >> bdrv_get_device_or_node_name(bs));
> >> goto out;
> >> }
> >> +
> >> + if (!blk && !bs->monitor_list.tqe_prev) {
> >> + error_setg(errp, "Node %s is not owned by the monitor",
> >> + bs->node_name);
> >> + goto out;
> >> + }
> >
> > Is this an extra restriction added by this patch?
>
> I hope not. This is just an additional check that should not change
> behavior; if it does, we did something wrong.
Actually, if you were to respin the series, you could remove the check
that it replaces:
if (bs->refcnt > 1 || !QLIST_EMPTY(&bs->parents)) {
The QLIST_EMPTY() check is trying to achieve the same as what you
introduce in a clean way now. It doesn't hurt at the moment, but I had
to get rid of the QLIST_EMPTY() check when I tried to convert BB to
BdrvChild.
Kevin
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2016-01-29 13:49 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-27 17:59 [Qemu-devel] [PATCH v8 00/16] block: Rework bdrv_close_all() Max Reitz
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 01/16] block: Release dirty bitmaps in bdrv_close() Max Reitz
2016-01-28 3:01 ` Fam Zheng
2016-01-29 13:27 ` Max Reitz
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 02/16] iotests: Add test for eject under NBD server Max Reitz
2016-01-27 20:56 ` Eric Blake
2016-01-29 13:07 ` Max Reitz
2016-01-28 3:05 ` Fam Zheng
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 03/16] block: Add BB-BDS remove/insert notifiers Max Reitz
2016-01-28 3:06 ` Fam Zheng
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 04/16] virtio-blk: Functions for op blocker management Max Reitz
2016-01-28 3:09 ` Fam Zheng
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 05/16] virtio-scsi: Catch BDS-BB removal/insertion Max Reitz
2016-01-28 3:14 ` Fam Zheng
2016-01-29 12:41 ` Kevin Wolf
2016-01-29 14:13 ` Max Reitz
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 06/16] nbd: Switch from close to eject notifier Max Reitz
2016-01-28 3:26 ` Fam Zheng
2016-01-29 13:39 ` Max Reitz
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 07/16] block: Remove BDS close notifier Max Reitz
2016-01-28 3:27 ` Fam Zheng
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 08/16] block: Use blk_remove_bs() in blk_delete() Max Reitz
2016-01-28 3:28 ` Fam Zheng
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 09/16] blockdev: Use blk_remove_bs() in do_drive_del() Max Reitz
2016-01-28 3:29 ` Fam Zheng
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 10/16] block: Make bdrv_close() static Max Reitz
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 11/16] block: Add list of all BlockDriverStates Max Reitz
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 12/16] blockdev: Keep track of monitor-owned BDS Max Reitz
2016-01-28 3:33 ` Fam Zheng
2016-01-29 13:44 ` Max Reitz
2016-01-29 13:49 ` Kevin Wolf [this message]
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 13/16] block: Add blk_remove_all_bs() Max Reitz
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 14/16] block: Rewrite bdrv_close_all() Max Reitz
2016-01-28 4:17 ` Fam Zheng
2016-01-29 13:54 ` Max Reitz
2016-01-27 17:59 ` [Qemu-devel] [PATCH v8 15/16] iotests: Add test for multiple BB on BDS tree Max Reitz
2016-01-27 18:00 ` [Qemu-devel] [PATCH v8 16/16] iotests: Add test for block jobs and BDS ejection Max Reitz
2016-01-29 13:45 ` [Qemu-devel] [PATCH v8 00/16] block: Rework bdrv_close_all() 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=20160129134947.GC4356@noname.redhat.com \
--to=kwolf@redhat.com \
--cc=berto@igalia.com \
--cc=famz@redhat.com \
--cc=jsnow@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/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.