block: Introduce bio_straddles_zones() and bio_offset_from_zone_start()
authorDamien Le Moal <dlemoal@kernel.org>
Mon, 8 Apr 2024 01:41:04 +0000 (10:41 +0900)
committerJens Axboe <axboe@kernel.dk>
Wed, 17 Apr 2024 14:44:02 +0000 (08:44 -0600)
commitb85a3c1b7978f942fa5bf8cfe22b6a6aaa49d3b7
treec4fcbd43d128322de3c937ac5a88e2aaffecb982
parenta0508c36efa838b16aa93a23e3583d68d3ef6c33
block: Introduce bio_straddles_zones() and bio_offset_from_zone_start()

Implement the inline helper functions bio_straddles_zones() and
bio_offset_from_zone_start() to respectively test if a BIO crosses a
zone boundary (the start sector and last sector belong to different
zones) and to obtain the offset of a BIO from the start sector of its
target zone.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Tested-by: Hans Holmberg <hans.holmberg@wdc.com>
Tested-by: Dennis Maisenbacher <dennis.maisenbacher@wdc.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Link: https://lore.kernel.org/r/20240408014128.205141-5-dlemoal@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/blkdev.h