Re: [PATCH v14 3/6] qcow2: add configurations for zoned format extension
Niklas Cassel <[email protected]>
| Newsgroups | gmane.comp.emulators.qemu.block,gmane.comp.emulators.qemu |
|---|---|
| Message-ID | <anUkEv3T9GqFzQ0q@ryzen> |
On Fri, Aug 07, 2026 at 02:06:52AM +0200, Niklas Cassel wrote: > On Fri, Aug 07, 2026 at 01:56:36AM +0200, Niklas Cassel wrote: > > Looking at the write_granularity in virtio-blk + file-posix: > > for blkcfg.zoned.write_granularity, which is what virtio-blk exposes to > > the guest, it is initialized using: > > https://github.com/qemu/qemu/blob/v11.1.0-rc3/hw/block/virtio-blk.c#L1257 > > conf->logical_block_size: > > https://github.com/qemu/qemu/blob/v11.1.0-rc3/hw/block/virtio-blk.c#L1183 > > > > and the value we set to the qemu block layer - bs->bl.write_granularity, > > which file-posix initilizes using: > > https://github.com/qemu/qemu/blob/v11.1.0-rc3/block/file-posix.c#L1498-L1501 > > the sysfs value for physical_block_size. > > If we are using sysfs, I wonder why this code does not simply read: > /sys/block/<disk>/queue/zone_write_granularity > instead. > > > But that would still be inconsistent with blkcfg.zoned.write_granularity which > is initialized using conf->logical_block_size. At least QEMU is currently bug compatible with Linux: linux $ git grep "zone_write_granularity =" block/blk-settings.c: lim->zone_write_granularity = lim->logical_block_size; drivers/scsi/sd_zbc.c: lim->zone_write_granularity = sdkp->physical_block_size; Where blk-settings is using the logical block size, but SCSI is using the physical block size :) Kind regards, Niklas