From: Kevin Wolf <kwolf@redhat.com>
To: Alberto Garcia <berto@igalia.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org,
Max Reitz <mreitz@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v10 09/16] block: Add QMP support for streaming to an intermediate layer
Date: Wed, 12 Oct 2016 16:30:27 +0200 [thread overview]
Message-ID: <20161012143027.GL5544@noname.redhat.com> (raw)
In-Reply-To: <1c8e6e73084e968514b6522576cfacd1bf69609e.1475757437.git.berto@igalia.com>
Am 06.10.2016 um 15:02 hat Alberto Garcia geschrieben:
> This patch makes the 'device' parameter of the 'block-stream' command
> accept a node name that is not a root node.
>
> In addition to that, operation blockers will be checked in all
> intermediate nodes between the top and the base node.
>
> Signed-off-by: Alberto Garcia <berto@igalia.com>
> ---
> blockdev.c | 11 +++++++++--
> qapi/block-core.json | 10 +++++++---
> 2 files changed, 16 insertions(+), 5 deletions(-)
>
> diff --git a/blockdev.c b/blockdev.c
> index f13fc69..57c8329 100644
> --- a/blockdev.c
> +++ b/blockdev.c
> @@ -2937,7 +2937,7 @@ void qmp_block_stream(bool has_job_id, const char *job_id, const char *device,
> bool has_on_error, BlockdevOnError on_error,
> Error **errp)
> {
> - BlockDriverState *bs;
> + BlockDriverState *bs, *iter;
> BlockDriverState *base_bs = NULL;
> AioContext *aio_context;
> Error *local_err = NULL;
> @@ -2947,7 +2947,7 @@ void qmp_block_stream(bool has_job_id, const char *job_id, const char *device,
> on_error = BLOCKDEV_ON_ERROR_REPORT;
> }
>
> - bs = qmp_get_root_bs(device, errp);
> + bs = bdrv_lookup_bs(device, device, errp);
> if (!bs) {
> return;
> }
> aio_context = bdrv_get_aio_context(bs);
> aio_context_acquire(aio_context);
>
> if (bdrv_op_is_blocked(bs, BLOCK_OP_TYPE_STREAM, errp)) {
> goto out;
> }
Added a bit more context.
This check is redundant now...
> if (has_base) {
> base_bs = bdrv_find_backing_image(bs, base);
> if (base_bs == NULL) {
> error_setg(errp, QERR_BASE_NOT_FOUND, base);
> goto out;
> }
> assert(bdrv_get_aio_context(base_bs) == aio_context);
> base_name = base;
> }
>
> + /* Check for op blockers in the whole chain between bs and base */
> + for (iter = bs; iter && iter != base_bs; iter = backing_bs(iter)) {
> + if (bdrv_op_is_blocked(iter, BLOCK_OP_TYPE_STREAM, errp)) {
> + goto out;
> + }
> + }
...because you start with iter = bs here.
Another thought I had while looking at the previous few patches is
whether all the op blocker checks wouldn't be better moved to the actual
block job code (i.e. stream_start in this case). In this case it doesn't
matter much because this is the only caller of stream_start(), but for
other jobs the situation is more complicated and it would be easy for a
caller to forget the checks.
Probably also matter for another series, but I wanted to mention it.
> +
> /* if we are streaming the entire chain, the result will have no backing
> * file, and specifying one is therefore an error */
> if (base_bs == NULL && has_backing_file) {
Kevin
next prev parent reply other threads:[~2016-10-12 14:30 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-06 13:02 [Qemu-devel] [PATCH v10 00/16] Support streaming to an intermediate layer Alberto Garcia
2016-10-06 13:02 ` [Qemu-devel] [PATCH v10 01/16] block: Pause all jobs during bdrv_reopen_multiple() Alberto Garcia
2016-10-10 15:37 ` Kevin Wolf
2016-10-10 16:41 ` Paolo Bonzini
2016-10-11 9:39 ` Kevin Wolf
2016-10-11 9:54 ` Paolo Bonzini
2016-10-11 11:07 ` Kevin Wolf
2016-10-06 13:02 ` [Qemu-devel] [PATCH v10 02/16] block: Add block_job_add_bdrv() Alberto Garcia
2016-10-10 15:46 ` Kevin Wolf
2016-10-06 13:02 ` [Qemu-devel] [PATCH v10 03/16] block: Use block_job_add_bdrv() in mirror_start_job() Alberto Garcia
2016-10-10 16:03 ` Kevin Wolf
2016-10-11 8:20 ` Paolo Bonzini
2016-10-11 13:46 ` Alberto Garcia
2016-10-11 14:01 ` Kevin Wolf
2016-10-06 13:02 ` [Qemu-devel] [PATCH v10 04/16] block: Use block_job_add_bdrv() in backup_start() Alberto Garcia
2016-10-12 13:47 ` Kevin Wolf
2016-10-12 13:57 ` Alberto Garcia
2016-10-06 13:02 ` [Qemu-devel] [PATCH v10 05/16] block: Check blockers in all nodes involved in a block-commit job Alberto Garcia
2016-10-12 13:47 ` Kevin Wolf
2016-10-06 13:02 ` [Qemu-devel] [PATCH v10 06/16] block: Block all nodes involved in the block-commit operation Alberto Garcia
2016-10-12 13:54 ` Kevin Wolf
2016-10-06 13:02 ` [Qemu-devel] [PATCH v10 07/16] block: Block all intermediate nodes in commit_active_start() Alberto Garcia
2016-10-12 14:06 ` Kevin Wolf
2016-10-06 13:02 ` [Qemu-devel] [PATCH v10 08/16] block: Support streaming to an intermediate layer Alberto Garcia
2016-10-12 14:23 ` Kevin Wolf
2016-10-12 14:33 ` Alberto Garcia
2016-10-12 14:45 ` Kevin Wolf
2016-10-06 13:02 ` [Qemu-devel] [PATCH v10 09/16] block: Add QMP support for " Alberto Garcia
2016-10-10 19:09 ` Eric Blake
2016-10-11 14:30 ` Alberto Garcia
2016-10-11 14:57 ` Kevin Wolf
2016-10-11 15:53 ` Eric Blake
2016-10-11 16:50 ` Markus Armbruster
2016-10-12 9:11 ` Kevin Wolf
2016-10-12 9:25 ` Alberto Garcia
2016-10-11 16:32 ` Markus Armbruster
2016-10-12 9:28 ` Alberto Garcia
2016-10-12 12:17 ` Markus Armbruster
2016-10-12 14:30 ` Kevin Wolf [this message]
2016-10-12 14:48 ` Alberto Garcia
2016-10-06 13:02 ` [Qemu-devel] [PATCH v10 10/16] docs: Document how to stream " Alberto Garcia
2016-10-12 14:39 ` Kevin Wolf
2016-10-06 13:02 ` [Qemu-devel] [PATCH v10 11/16] qemu-iotests: Test streaming " Alberto Garcia
2016-10-06 13:02 ` [Qemu-devel] [PATCH v10 12/16] qemu-iotests: Test block-stream operations in parallel Alberto Garcia
2016-10-06 13:02 ` [Qemu-devel] [PATCH v10 13/16] qemu-iotests: Test overlapping stream and commit operations Alberto Garcia
2016-10-06 13:02 ` [Qemu-devel] [PATCH v10 14/16] qemu-iotests: Test block-stream and block-commit in parallel Alberto Garcia
2016-10-06 13:02 ` [Qemu-devel] [PATCH v10 15/16] qemu-iotests: Add iotests.supports_quorum() Alberto Garcia
2016-10-06 13:02 ` [Qemu-devel] [PATCH v10 16/16] qemu-iotests: Test streaming to a Quorum child Alberto Garcia
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=20161012143027.GL5544@noname.redhat.com \
--to=kwolf@redhat.com \
--cc=armbru@redhat.com \
--cc=berto@igalia.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.