On 11/3/25 17:31, Damien Le Moal wrote: > Introduce the function blkdev_get_zone_info() to obtain a single zone > information from cached zone data, that is, either from the zone write > plug for the target zone if it exists and from the disk zones_cond > array otherwise. > > Since sequential zones that do not have a zone write plug are either > full, empty or in a bad state (read-only or offline), the zone write > pointer can be inferred from the zone condition cached in the disk > zones_cond array. For sequential zones that have a zone write plug, the > zone condition and zone write pointer are obtained from the condition > and write pointer offset managed with the zone write plug. This allows > obtaining the information for a zone much more quickly than having to > execute a report zones command on the device. > > blkdev_get_zone_info() falls back to using a regular zone report if the > target zone is flagged as needing an update with the > BLK_ZONE_WPLUG_NEED_WP_UPDATE flag, or if the target device does not > use zone write plugs (i.e. a device mapper device). In this case, the > new function blkdev_report_zone_fallback() is used and the zone > condition is reported consistantly with the cahced report, that is, the > BLK_ZONE_COND_ACTIVE condition is used in place of the implicit open, > explicit open and closed conditions. This is achieved by adding the > .report_active field to struct blk_report_zones_args and by having > disk_report_zone() sets the correct zone condition if .report_active is > true. > > In preparation for using blkdev_get_zone_info() in upcoming file systems > changes, also export this function as a GPL symbol. > > 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
