On Tue, Aug 23, 2022 at 12:25:23PM +0800, Sam Li wrote: > Stefan Hajnoczi <stefa...@redhat.com> 于2022年8月23日周二 08:54写道: > > > > 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 <faithilike...@gmail.com> > > > Reviewed-by: Stefan Hajnoczi <stefa...@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) { > > > > Should be: > +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. > > > > ? > > No. It should be: > > If the parent does not support zoned children and the child is zoned, > fail with an error. It should handle the case where a filter node is > inserted above a raw block driver with a zoned_host_device child. > > There are some QEMU command-line constraints for the zoned devices. I > was wondering where to add such support so that it can print an error > message for users: > 1. cache.direct= setting
The O_DIRECT requirement is specific to file-posix and Linux's zoned block device implementation, so it belongs in file-posix.c's zoned_host_device .bdrv_file_open() function. > 2. mix zoned/non-zoned drivers This is generic and I think bdrv_add_child() is the right place for parent-child compatibility checks.
signature.asc
Description: PGP signature