On 11/3/25 17:31, Damien Le Moal wrote: > The conv_zones_bitmap field of struct gendisk is used to define a bitmap > to identify the conventional zones of a zoned block device. The bit for > a zone is set in this bitmap if the zone is a conventional one, that is, > if the zone type is BLK_ZONE_TYPE_CONVENTIONAL. For such zone, this > always corresponds to the zone condition BLK_ZONE_COND_NOT_WP. > In other words, conv_zones_bitmap tracks a single condition of the > zones of a zoned block device. > > In preparation for tracking more zone conditions, change > conv_zones_bitmap into an array of zone conditions, using 1 byte per > zone. This increases the memory usage from 1 bit per zone to 1 byte per > zone, that is, from 16 KiB to about 100 KiB for a 30 TB SMR HDD with 256 > MiB zones. This is a trade-off to allow fast cached report zones later > on top of this change. > > Rename the conv_zones_bitmap field of struct gendisk to zones_cond. Add > a blk_revalidate_zone_cond() function to initialize the zones_cond array > of a disk during device scan and to update it on device revalidation. > Move the allocation of the zones_cond array to > disk_revalidate_zone_resources(), making sure that this array is always > allocated, even for devices that do not need zone write plugs (zone > resources), to ensure that bdev_zone_is_seq() can be re-implemented to > use the zone condition array in place of the conv zones bitmap. > > Finally, the function bdev_zone_is_seq() is rewritten to use a test on > the condition of the target zone. > > Signed-off-by: Damien Le Moal<[email protected]> > Reviewed-by: Christoph Hellwig<[email protected]> > Reviewed-by: Johannes Thumshirn<[email protected]>
Looks good. Reviewed-by: Chaitanya Kulkarni <[email protected]> -ck
