Commit 5debd969 authored by Keith Busch's avatar Keith Busch Committed by Jens Axboe

block: introduce bdev_iter_is_aligned helper

Provide a convenient function for this repeatable coding pattern.
Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220610195830.3574005-10-kbusch@fb.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent cfa320f7
...@@ -1370,6 +1370,13 @@ static inline unsigned int bdev_dma_alignment(struct block_device *bdev) ...@@ -1370,6 +1370,13 @@ static inline unsigned int bdev_dma_alignment(struct block_device *bdev)
return queue_dma_alignment(bdev_get_queue(bdev)); return queue_dma_alignment(bdev_get_queue(bdev));
} }
static inline bool bdev_iter_is_aligned(struct block_device *bdev,
struct iov_iter *iter)
{
return iov_iter_is_aligned(iter, bdev_dma_alignment(bdev),
bdev_logical_block_size(bdev) - 1);
}
static inline int blk_rq_aligned(struct request_queue *q, unsigned long addr, static inline int blk_rq_aligned(struct request_queue *q, unsigned long addr,
unsigned int len) unsigned int len)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment