From: Stefan Hajnoczi <stefanha@redhat.com>
To: Sam Li <faithilikerun@gmail.com>
Cc: qemu-devel@nongnu.org, hare@suse.de, Fam Zheng <fam@euphon.net>,
Kevin Wolf <kwolf@redhat.com>, Eric Blake <eblake@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
Hanna Reitz <hreitz@redhat.com>,
dmitry.fomichev@wdc.com, qemu-block@nongnu.org,
damien.lemoal@opensource.wdc.com
Subject: Re: [PATCH v7 6/8] config: add check to block layer
Date: Mon, 22 Aug 2022 20:54:36 -0400 [thread overview]
Message-ID: <YwQlTFHqKqjurCgb@fedora> (raw)
In-Reply-To: <20220816062522.85714-7-faithilikerun@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2802 bytes --]
On Tue, Aug 16, 2022 at 02:25:20PM +0800, Sam Li wrote:
> Putting zoned/non-zoned BlockDrivers on top of each other is not
> allowed.
>
> Signed-off-by: Sam Li <faithilikerun@gmail.com>
> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> block.c | 14 ++++++++++++++
> block/raw-format.c | 1 +
> include/block/block_int-common.h | 5 +++++
> 3 files changed, 20 insertions(+)
>
> diff --git a/block.c b/block.c
> index bc85f46eed..affe6c597e 100644
> --- a/block.c
> +++ b/block.c
> @@ -7947,6 +7947,20 @@ void bdrv_add_child(BlockDriverState *parent_bs, BlockDriverState *child_bs,
> return;
> }
>
> + /*
> + * Non-zoned block drivers do not follow zoned storage constraints
> + * (i.e. sequential writes to zones). Refuse mixing zoned and non-zoned
> + * drivers in a graph.
> + */
> + if (!parent_bs->drv->supports_zoned_children &&
> + child_bs->bl.zoned != BLK_Z_HM) {
Is this logical expression correct:
If the parent does not support zoned children and the child is not
zoned, fail with an error.
?
> + error_setg(errp, "Cannot add a %s child to a %s parent",
> + child_bs->bl.zoned == BLK_Z_HM ? "zoned" : "non-zoned",
> + parent_bs->drv->supports_zoned_children ?
> + "support zoned children" : "not support zoned children");
> + return;
> + }
> +
> if (!QLIST_EMPTY(&child_bs->parents)) {
> error_setg(errp, "The node %s already has a parent",
> child_bs->node_name);
> diff --git a/block/raw-format.c b/block/raw-format.c
> index 6b20bd22ef..9441536819 100644
> --- a/block/raw-format.c
> +++ b/block/raw-format.c
> @@ -614,6 +614,7 @@ static void raw_child_perm(BlockDriverState *bs, BdrvChild *c,
> BlockDriver bdrv_raw = {
> .format_name = "raw",
> .instance_size = sizeof(BDRVRawState),
> + .supports_zoned_children = true,
> .bdrv_probe = &raw_probe,
> .bdrv_reopen_prepare = &raw_reopen_prepare,
> .bdrv_reopen_commit = &raw_reopen_commit,
> diff --git a/include/block/block_int-common.h b/include/block/block_int-common.h
> index de44c7b6f4..4c44592b59 100644
> --- a/include/block/block_int-common.h
> +++ b/include/block/block_int-common.h
> @@ -126,6 +126,11 @@ struct BlockDriver {
> */
> bool is_format;
>
> + /*
> + * Set to true if the BlockDriver supports zoned children.
> + */
> + bool supports_zoned_children;
> +
> /*
> * Drivers not implementing bdrv_parse_filename nor bdrv_open should have
> * this field set to true, except ones that are defined only by their
> --
> 2.37.1
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2022-08-23 0:55 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-16 6:25 [PATCH v7 0/8] Add support for zoned device Sam Li
2022-08-16 6:25 ` [PATCH v7 1/8] include: add zoned device structs Sam Li
2022-08-16 17:27 ` Damien Le Moal
2022-08-16 6:25 ` [PATCH v7 2/8] file-posix: introduce get_sysfs_str_val for device zoned model Sam Li
2022-08-16 16:11 ` Sam Li
2022-08-16 17:32 ` Damien Le Moal
2022-08-22 23:05 ` Stefan Hajnoczi
2022-08-23 4:31 ` Sam Li
2022-08-16 6:25 ` [PATCH v7 3/8] file-posix: introduce get_sysfs_long_val for the long sysfs attribute Sam Li
2022-08-16 16:13 ` Sam Li
2022-08-16 17:35 ` Damien Le Moal
2022-08-16 17:53 ` Sam Li
2022-08-16 17:55 ` Damien Le Moal
2022-08-16 6:25 ` [PATCH v7 4/8] block: add block layer APIs resembling Linux ZonedBlockDevice ioctls Sam Li
2022-08-16 17:50 ` Damien Le Moal
2022-08-26 12:20 ` Sam Li
2022-08-23 0:49 ` Stefan Hajnoczi
2022-08-23 4:12 ` Sam Li
2022-08-23 12:40 ` Stefan Hajnoczi
2022-08-24 23:46 ` Damien Le Moal
2022-08-24 23:53 ` Damien Le Moal
2022-08-16 6:25 ` [PATCH v7 5/8] raw-format: add zone operations to pass through requests Sam Li
2022-08-16 6:25 ` [PATCH v7 6/8] config: add check to block layer Sam Li
2022-08-23 0:54 ` Stefan Hajnoczi [this message]
2022-08-23 4:25 ` Sam Li
2022-08-23 12:36 ` Stefan Hajnoczi
2022-08-16 6:25 ` [PATCH v7 7/8] qemu-iotests: test new zone operations Sam Li
2022-08-16 6:25 ` [PATCH v7 8/8] docs/zoned-storage: add zoned device documentation Sam Li
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=YwQlTFHqKqjurCgb@fedora \
--to=stefanha@redhat.com \
--cc=armbru@redhat.com \
--cc=damien.lemoal@opensource.wdc.com \
--cc=dmitry.fomichev@wdc.com \
--cc=eblake@redhat.com \
--cc=faithilikerun@gmail.com \
--cc=fam@euphon.net \
--cc=hare@suse.de \
--cc=hreitz@redhat.com \
--cc=kwolf@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.