Re: [PATCH 07/26] block: Allow zero value of max_zone_append_sectors queue limit

Hannes Reinecke
2024-02-04T12:15:24Z

On 2/2/24 15:30, Damien Le Moal wrote:
> In preparation for adding a generic zone append emulation using zone
> write plugging, allow device drivers supporting zoned block device to
> set a the max_zone_append_sectors queue limit of a device to 0 to
> indicate the lack of native support for zone append operations and that
> the block layer should emulate these operations using regular write
> operations.
>
> blk_queue_max_zone_append_sectors() is modified to allow passing 0 as
> the max_zone_append_sectors argument. The function
> queue_max_zone_append_sectors() is also modified to ensure that the
> minimum of the max_sectors and chunk_sectors limit is used whenever the
> max_zone_append_sectors limit is 0.
>
> The helper functions queue_emulates_zone_append() and
> bdev_emulates_zone_append() are added to test if a queue (or block
> device) emulates zone append operations.
>
> In order for blk_revalidate_disk_zones() to accept zoned block devices
> relying on zone append emulation, the direct check to the
> max_zone_append_sectors queue limit of the disk is replaced by a check
> using the value returned by queue_max_zone_append_sectors(). Similarly,
> queue_zone_append_max_show() is modified to use the same accessor so
> that the sysfs attribute advertizes the non-zero limit that will be
> used, regardless if it is for native or emulated commands.
>
> For stacking drivers, a top device should not need to care if the
> underlying devices have native or emulated zone append operations.
> blk_stack_limits() is thus modified to set the top device
> max_zone_append_sectors limit using the new accessor
> queue_limits_max_zone_append_sectors(). queue_max_zone_append_sectors()
> is modified to use this function as well. Stacking drivers that require
> zone append emulation, e.g. dm-crypt, can still request this feature by
> calling blk_queue_max_zone_append_sectors() with a 0 limit.
>
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> ---
> block/blk-core.c | 2 +-
> block/blk-settings.c | 35 +++++++++++++++++++++++------------
> block/blk-sysfs.c | 2 +-
> block/blk-zoned.c | 2 +-
> include/linux/blkdev.h | 20 +++++++++++++++++---
> 5 files changed, 43 insertions(+), 18 deletions(-)
>
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Ivo Totev, Andrew McDonald,
Werner Knoblich