From: Eric Blake <eblake@redhat.com>
To: Manos Pitsidianakis <el13635@mail.ntua.gr>,
qemu-devel <qemu-devel@nongnu.org>
Cc: qemu-block <qemu-block@nongnu.org>,
Alberto Garcia <berto@igalia.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Max Reitz <mreitz@redhat.com>, Kevin Wolf <kwolf@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v5 1/4] block: pass bdrv_* methods to bs->file by default in block filters
Date: Thu, 13 Jul 2017 06:23:14 -0500 [thread overview]
Message-ID: <61c88e57-e607-a0fc-6441-175b24d55b74@redhat.com> (raw)
In-Reply-To: <20170713100117.11961-2-el13635@mail.ntua.gr>
[-- Attachment #1: Type: text/plain, Size: 2435 bytes --]
On 07/13/2017 05:01 AM, Manos Pitsidianakis wrote:
> The following functions fail if bs->drv is a filter and does not
> implement them:
>
> bdrv_probe_blocksizes
> bdrv_probe_geometry
> bdrv_truncate
> bdrv_has_zero_init
> bdrv_get_info
>
> Instead, the call should be passed to bs->file if it exists, to allow
> filter drivers to support those methods without implementing them. This
> commit makes `drv->is_filter = true` imply that these callbacks will be
> forwarded to bs->file by default, so disabling support for these
> functions must be done explicitly.
>
> Reviewed-by: Eric Blake <eblake@redhat.com>
I would have dropped R-b on the grounds that you added comments to
'is_filter' (good! but non-trivial), to make sure it gets a
grammar/wording review of the new content. Furthermore, your patch had
a semantic change due to the rebase, and looking at that change...
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> Signed-off-by: Manos Pitsidianakis <el13635@mail.ntua.gr>
> ---
> @@ -3420,11 +3424,15 @@ int bdrv_truncate(BdrvChild *child, int64_t offset, PreallocMode prealloc,
>
> assert(child->perm & BLK_PERM_RESIZE);
>
> + /* if bs->drv == NULL, bs is closed, so there's nothing to do here */
> if (!drv) {
> error_setg(errp, "No medium inserted");
> return -ENOMEDIUM;
> }
> if (!drv->bdrv_truncate) {
> + if (bs->file && drv->is_filter) {
> + return bdrv_truncate(bs->file, prealloc, offset, errp);
...ouch - you got it wrong. s/prealloc, offset/offset, prealloc/
> +++ b/include/block/block_int.h
> @@ -87,7 +87,11 @@ struct BlockDriver {
> const char *format_name;
> int instance_size;
>
> - /* set to true if the BlockDriver is a block filter */
> + /* set to true if the BlockDriver is a block filter. Block filters pass
> + * certain callbacks that refer to data (see block.c) to their bs->file if
> + * the driver doesn't implement them. Drivers that do not wish to forward
> + * must implement them and return -ENOTSUP.
> + */
> bool is_filter;
I'm okay with the new comment.
With the swapped parameter order fixed (the maintainer can probably do
that),
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2017-07-13 11:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-13 10:01 [Qemu-devel] [PATCH v5 0/4] block: Block driver callbacks fixes Manos Pitsidianakis
2017-07-13 10:01 ` [Qemu-devel] [PATCH v5 1/4] block: pass bdrv_* methods to bs->file by default in block filters Manos Pitsidianakis
2017-07-13 11:23 ` Eric Blake [this message]
2017-07-13 11:39 ` Manos Pitsidianakis
2017-07-13 10:01 ` [Qemu-devel] [PATCH v5 2/4] block: remove unused bdrv_media_changed Manos Pitsidianakis
2017-07-13 10:01 ` [Qemu-devel] [PATCH v5 3/4] block: remove bdrv_truncate callback in blkdebug Manos Pitsidianakis
2017-07-13 10:01 ` [Qemu-devel] [PATCH v5 4/4] block: add default implementations for bdrv_co_get_block_status() Manos Pitsidianakis
2017-07-13 11:18 ` [Qemu-devel] [PATCH v5 0/4] block: Block driver callbacks fixes Eric Blake
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=61c88e57-e607-a0fc-6441-175b24d55b74@redhat.com \
--to=eblake@redhat.com \
--cc=berto@igalia.com \
--cc=el13635@mail.ntua.gr \
--cc=kwolf@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 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).