Eric Blake <ebl...@redhat.com> 于2023年9月29日周五 03:17写道: > > On Mon, Sep 18, 2023 at 05:53:12PM +0800, Sam Li wrote: > > By adding zone operations and zoned metadata, the zoned emulation > > capability enables full emulation support of zoned device using > > a qcow2 file. The zoned device metadata includes zone type, > > zoned device state and write pointer of each zone, which is stored > > to an array of unsigned integers. > > > > Each zone of a zoned device makes state transitions following > > the zone state machine. The zone state machine mainly describes > > five states, IMPLICIT OPEN, EXPLICIT OPEN, FULL, EMPTY and CLOSED. > > READ ONLY and OFFLINE states will generally be affected by device > > internal events. The operations on zones cause corresponding state > > changing. > > > > Zoned devices have a limit on zone resources, which puts constraints on > > write operations into zones. > > > > Signed-off-by: Sam Li <faithilike...@gmail.com> > > --- > > block/qcow2.c | 709 ++++++++++++++++++++++++++++++++++++++++- > > block/qcow2.h | 2 + > > block/trace-events | 2 + > > docs/interop/qcow2.txt | 6 + > > 4 files changed, 717 insertions(+), 2 deletions(-) > > You may want to look at scripts/git.orderfile; putting spec changes > (docs/*) first in your output before implementation is generally > beneficial to reviewers. > > > +++ b/docs/interop/qcow2.txt > > @@ -367,6 +367,12 @@ The fields of the zoned extension are: > > The maximal number of 512-byte sectors of a zone > > append request that can be issued to the device. > > > > + 36 - 43: zonedmeta_offset > > + The offset of zoned metadata structure in the file in > > bytes. > > For the spec to be useful, you also need to add a section describing > the layout of the zoned metadata structure actually is. > > > + > > + 44 - 51: zonedmeta_size > > + The size of zoned metadata in bytes. > > + > > Can the zoned metadata structure ever occupy more than 4G, or can this > field be sized at 4 bytes instead of 8?
The zoned metadata is the write pointers of all zones. The size of it is nr_zones (uint32_t) * write_pointer size (uint64_t). So it will not occupy more than 4G. But it still need more than 4 bytes. > > -- > Eric Blake, Principal Software Engineer > Red Hat, Inc. > Virtualization: qemu.org | libguestfs.org >