diff options
| author | Damien Le Moal <dlemoal@kernel.org> | 2025-11-07 15:38:44 +0900 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2025-11-07 09:28:08 -0700 |
| commit | 25976c314f6596254c9b1e2291d94393b7d5ae81 (patch) | |
| tree | 8926ba66b070babdadb1c03b766b19199851cfad /include/linux/blkdev.h | |
| parent | e2b0ec776164c11569ee021fac89596a2642654c (diff) | |
| download | lwn-25976c314f6596254c9b1e2291d94393b7d5ae81.tar.gz lwn-25976c314f6596254c9b1e2291d94393b7d5ae81.zip | |
block: introduce bdev_zone_start()
Introduce the function bdev_zone_start() as a more explicit (and clear)
replacement for ALIGN_DOWN() to get the start sector of a zone
containing a particular sector of a zoned block device.
Use this new helper in blkdev_get_zone_info() and
blkdev_report_zones_cached().
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/blkdev.h')
| -rw-r--r-- | include/linux/blkdev.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 6a498aa7f7e7..2fff8a80dbd2 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1522,6 +1522,12 @@ static inline sector_t bdev_zone_sectors(struct block_device *bdev) return q->limits.chunk_sectors; } +static inline sector_t bdev_zone_start(struct block_device *bdev, + sector_t sector) +{ + return sector & ~(bdev_zone_sectors(bdev) - 1); +} + static inline sector_t bdev_offset_from_zone_start(struct block_device *bdev, sector_t sector) { |
