On Tue, Jun 23, 2026 at 08:48:27PM +0200, Sam Li wrote:
> To configure the zoned format feature on the qcow2 driver, it
> requires settings as: the device size, zone model, zone size,
> zone capacity, number of conventional zones, limits on zone
> resources (max append bytes, max open zones, and max_active_zones).
>
> To create a qcow2 image with zoned format feature, use command like
> this:
> qemu-img create -f qcow2 zbc.qcow2 -o size=768M \
> -o zone.size=64M -o zone.capacity=64M -o zone.conventional_zones=0 \
> -o zone.max_append_bytes=4096 -o zone.max_open_zones=6 \
> -o zone.max_active_zones=8 -o zone.mode=host-managed
>
> Signed-off-by: Sam Li <[email protected]>
> Acked-by: Markus Armbruster <[email protected]> # QAPI schema
> ---
> block/file-posix.c | 2 +-
> block/qcow2.c | 335 ++++++++++++++++++++++++++++++-
> block/qcow2.h | 83 +++++++-
> docs/interop/qcow2.rst | 120 ++++++++++-
> include/block/block_int-common.h | 15 +-
> qapi/block-core.json | 91 ++++++++-
> tests/qemu-iotests/082.out | 126 ++++++++++++
> 7 files changed, 763 insertions(+), 9 deletions(-)
>
> diff --git a/block/file-posix.c b/block/file-posix.c
> index 3c985da94f..ddb159c58b 100644
> --- a/block/file-posix.c
> +++ b/block/file-posix.c
> @@ -3600,7 +3600,7 @@ raw_co_zone_append(BlockDriverState *bs,
>
> if (*offset & zone_size_mask) {
> error_report("sector offset %" PRId64 " is not aligned to zone size "
> - "%" PRId32 "", *offset / 512, bs->bl.zone_size / 512);
> + "%" PRId64 "", *offset / 512, bs->bl.zone_size / 512);
> return -EINVAL;
> }
I think it would be easier if this change, together with:
> @@ -901,7 +908,13 @@ typedef struct BlockLimits {
> BlockZoneModel zoned;
>
> /* zone size expressed in bytes */
> - uint32_t zone_size;
> + uint64_t zone_size;
was in a separate prep patch earlier in this series.
While I understand the logic behind increasing the zone_size to uint64_t
(i.e. to match "struct blk_zone" struct member "len" (representing
zone size) in Linux include/uapi/linux/blkzoned.h), this seems like an
independent change that should be done to the QEMU block layer, that
does not really have anything to do with adding qcow2 zoned support.
Kind regards,
Niklas