On Mon, Sep 21, 2026 at 04:28:06PM +0200, Niklas Cassel wrote: > Whether a zone is conventional is encoded in the most significant bit of > the write pointer that the block layer keeps for it, so a caller that > wants to know has to reach into bs->wps->wp[] and apply BDRV_ZT_IS_CONV() > to the raw value. virtio-blk does that, which means a device model both > knows how a block driver stores its write pointers and knows what one of > the bits of a write pointer means. > > Add an accessor next to bdrv_zone_index() and use it there, so that the > encoding stays with the code that chose it. > > Unlike bdrv_zone_is_full(), this does not need the write pointer lock. > get_zones_wp() only ever sets the bit for a conventional zone and never > clears it, and a zone does not change type, so the answer cannot become > stale. The rest of the word does change, on every write, which is what > the lock is there for. > > Signed-off-by: Niklas Cassel <[email protected]> > --- > block/io.c | 7 +++++++ > hw/block/virtio-blk.c | 2 +- > include/block/block-io.h | 6 ++++++ > 3 files changed, 14 insertions(+), 1 deletion(-)
Reviewed-by: Stefan Hajnoczi <[email protected]>
signature.asc
Description: PGP signature
