[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v4 1/4] block: pass bdrv_* methods to bs->file b
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v4 1/4] block: pass bdrv_* methods to bs->file by default in block filters |
Date: |
Tue, 11 Jul 2017 12:02:14 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
On 07/11/2017 11:37 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.
>
> Signed-off-by: Manos Pitsidianakis <address@hidden>
> ---
> block.c | 21 +++++++++++++++++++--
> include/block/block_int.h | 6 +++++-
> 2 files changed, 24 insertions(+), 3 deletions(-)
> @@ -3778,6 +3786,9 @@ int bdrv_has_zero_init(BlockDriverState *bs)
> if (bs->drv->bdrv_has_zero_init) {
> return bs->drv->bdrv_has_zero_init(bs);
> }
> + if (bs->file && bs->drv->is_filter) {
> + return bdrv_has_zero_init(bs->file->bs);
> + }
>
> /* safe default */
> return 0;
Someday, we should probably clean this function (and all callback
implementations) to return bool rather than int. But not this patch.
Certainly more conservative than the earlier versions. I'd still trust
Kevin's review over mine, but looks okay to me.
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH v4 2/4] block: remove bdrv_media_changed, (continued)
Re: [Qemu-devel] [PATCH v4 2/4] block: remove bdrv_media_changed, Stefan Hajnoczi, 2017/07/12
Re: [Qemu-devel] [PATCH v4 2/4] block: remove bdrv_media_changed, Eric Blake, 2017/07/12
[Qemu-devel] [PATCH v4 3/4] block: remove bdrv_truncate callback in blkdebug, Manos Pitsidianakis, 2017/07/11
[Qemu-devel] [PATCH v4 4/4] block: add default implementations for bdrv_co_get_block_status(), Manos Pitsidianakis, 2017/07/11
[Qemu-devel] [PATCH v4 1/4] block: pass bdrv_* methods to bs->file by default in block filters, Manos Pitsidianakis, 2017/07/11
Re: [Qemu-devel] [PATCH v4 0/4] block: Block driver callbacks fixes, Markus Armbruster, 2017/07/12