mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
block: add a new helper bdev_{is_zone_start, offset_from_zone_start}
Instead of open coding to check for zone start, add a helper to improve readability and store the logic in one place. Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Pankaj Raghav <p.raghav@samsung.com> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Link: https://lore.kernel.org/r/20230110143635.77300-3-p.raghav@samsung.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
committed by
Jens Axboe
parent
fea127b36c
commit
e29b210021
@@ -1306,6 +1306,18 @@ static inline sector_t bdev_zone_sectors(struct block_device *bdev)
|
||||
return q->limits.chunk_sectors;
|
||||
}
|
||||
|
||||
static inline sector_t bdev_offset_from_zone_start(struct block_device *bdev,
|
||||
sector_t sector)
|
||||
{
|
||||
return sector & (bdev_zone_sectors(bdev) - 1);
|
||||
}
|
||||
|
||||
static inline bool bdev_is_zone_start(struct block_device *bdev,
|
||||
sector_t sector)
|
||||
{
|
||||
return bdev_offset_from_zone_start(bdev, sector) == 0;
|
||||
}
|
||||
|
||||
static inline int queue_dma_alignment(const struct request_queue *q)
|
||||
{
|
||||
return q ? q->limits.dma_alignment : 511;
|
||||
|
Reference in New Issue
Block a user