block: introduce bdev_dma_alignment helper
authorKeith Busch <kbusch@kernel.org>
Fri, 10 Jun 2022 19:58:23 +0000 (12:58 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 27 Jun 2022 12:29:11 +0000 (06:29 -0600)
Preparing for upcoming dma_alignment users that have a block_device, but
don't need the request_queue.

Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220610195830.3574005-5-kbusch@fb.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
include/linux/blkdev.h

index 2f7b434..2556fcd 100644 (file)
@@ -1365,6 +1365,11 @@ static inline int queue_dma_alignment(const struct request_queue *q)
        return q ? q->dma_alignment : 511;
 }
 
+static inline unsigned int bdev_dma_alignment(struct block_device *bdev)
+{
+       return queue_dma_alignment(bdev_get_queue(bdev));
+}
+
 static inline int blk_rq_aligned(struct request_queue *q, unsigned long addr,
                                 unsigned int len)
 {