[PATCH v3 10/15] block: introduce blkdev_report_zones_cached()

Hannes Reinecke hare at suse.de
Tue Nov 4 23:10:10 PST 2025


On 11/4/25 02:31, Damien Le Moal wrote:
> Introduce the function blkdev_report_zones_cached() to provide a fast
> report zone built using the blkdev_get_zone_info() function, which gets
> zone information from a disk zones_cond array or zone write plugs.
> For a large capacity SMR drive, such fast report zone can be completed
> in a few milliseconds compared to several seconds completion times
> when the report zone is obtained from the device.
> 
> The zone report is built in the same manner as with the regular
> blkdev_report_zones() function, that is, the first zone reported is the
> one containing the specified start sector and the report is limited to
> the specified number of zones (nr_zones argument). The information for
> each zone in the report is obtained using blkdev_get_zone_info().
> 
> For zoned devices that do not use zone write plug resources,
> using blkdev_get_zone_info() is inefficient as the zone report would
> be very slow, generated one zone at a time. To avoid this,
> blkdev_report_zones_cached() falls back to calling
> blkdev_do_report_zones() to execute a regular zone report. In this case,
> the .report_active field of struct blk_report_zones_args is set to true
> to report zone conditions using the BLK_ZONE_COND_ACTIVE condition in
> place of the implicit open, explicit open and closed conditions.
> 
> Signed-off-by: Damien Le Moal <dlemoal at kernel.org>
> Reviewed-by: Christoph Hellwig <hch at lst.de>
> ---
>   block/blk-zoned.c      | 88 +++++++++++++++++++++++++++++++++++-------
>   include/linux/blkdev.h |  2 +
>   2 files changed, 77 insertions(+), 13 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare at suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                  Kernel Storage Architect
hare at suse.de                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich



More information about the Linux-nvme mailing list