On Mon, Jun 05, 2023 at 06:41:06PM +0800, Sam Li wrote: > To configure the zoned format feature on the qcow2 driver, it > requires following arguments: the device size, zoned profile, > zoned model, zone size, zone capacity, number of conventional > zones, limits on zone resources (max append sectors, max open > zones, and max_active_zones). > > To create a qcow2 file with zoned format, use command like this: > $ qemu-img create -f qcow2 test.qcow2 -o size=768M -o > zone_size=64M -o zone_capacity=64M -o zone_nr_conv=0 -o > max_append_sectors=512 -o max_open_zones=0 -o max_active_zones=0 > -o zoned_profile=zbc > > Signed-off-by: Sam Li <faithilike...@gmail.com> > --- > block/qcow2.c | 119 +++++++++++++++++++++++++++++++ > block/qcow2.h | 21 ++++++ > include/block/block-common.h | 5 ++ > include/block/block_int-common.h | 8 +++ > qapi/block-core.json | 46 ++++++++---- > 5 files changed, 185 insertions(+), 14 deletions(-) > ... > diff --git a/block/qcow2.c b/block/qcow2.c > index 7f3948360d..b886dab42b 100644 > --- a/block/qcow2.c > +++ b/block/qcow2.c > @@ -73,6 +73,7 @@ typedef struct { > #define QCOW2_EXT_MAGIC_CRYPTO_HEADER 0x0537be77 > #define QCOW2_EXT_MAGIC_BITMAPS 0x23852875 > #define QCOW2_EXT_MAGIC_DATA_FILE 0x44415441 > +#define QCOW2_EXT_MAGIC_ZONED_FORMAT 0x7a6264 > > static int coroutine_fn > qcow2_co_preadv_compressed(BlockDriverState *bs, > @@ -210,6 +211,7 @@ qcow2_read_extensions(BlockDriverState *bs, uint64_t > start_offset, > uint64_t offset; > int ret; > Qcow2BitmapHeaderExt bitmaps_ext; > + Qcow2ZonedHeaderExtension zoned_ext; > > if (need_update_header != NULL) { > *need_update_header = false; > @@ -431,6 +433,37 @@ qcow2_read_extensions(BlockDriverState *bs, uint64_t > start_offset, > break; > } > > + case QCOW2_EXT_MAGIC_ZONED_FORMAT: > + {
Missing a patch to docs/interop/qcow2.txt that describes the new header so that other qcow2 implementations can be interoperable with it. [unrelated - maybe we should convert that file to .rst someday?] -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org