Re: [PATCH v2 11/28] block: Implement zone append emulation

Hannes Reinecke
2024-03-27T07:28:52Z

On 3/25/24 05:44, Damien Le Moal wrote:
> Given that zone write plugging manages all writes to zones of a zoned
> block device and track the write pointer position of all zones,
> emulating zone append operations using regular writes can be
> implemented generically, without relying on the underlying device driver
> to implement such emulation. This is needed for devices that do not
> natively support the zone append command, e.g. SMR hard-disks.
>
> A device may request zone append emulation by setting its
> max_zone_append_sectors queue limit to 0. For such device, the function
> blk_zone_wplug_prepare_bio() changes zone append BIOs into
> non-mergeable regular write BIOs. Modified zone append BIOs are flagged
> with the new BIO flag BIO_EMULATES_ZONE_APPEND. This flag is checked
> on completion of the BIO in blk_zone_write_plug_bio_endio() to restore
> the original REQ_OP_ZONE_APPEND operation code of the BIO.
>
> The block layer internal inline helper function bio_is_zone_append() is
> added to test if a BIO is either a native zone append operation
> (REQ_OP_ZONE_APPEND operation code) or if it is flagged with
> BIO_EMULATES_ZONE_APPEND. Given that both native and emulated zone
> append BIO completion handling should be similar, The functions
> blk_update_request() and blk_zone_complete_request_bio() are modified to
> use bio_is_zone_append() to execute blk_zone_update_request_bio() for
> both native and emulated zone append operations.
>
> This commit contains contributions from Christoph Hellwig <hch@lst.de>.
>
> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
> ---
> block/blk-mq.c | 2 +-
> block/blk-zoned.c | 69 +++++++++++++++++++++++++++++++--------
> block/blk.h | 14 ++++++--
> include/linux/blk_types.h | 1 +
> 4 files changed, 69 insertions(+), 17 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, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich