diff options
author | Keith Busch <kbusch@kernel.org> | 2022-06-10 22:58:28 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-06-27 15:29:11 +0300 |
commit | 5debd9691c3ac64c3acd6867c264ad38bbe48cdc (patch) | |
tree | a803cd5866331f2816aba1d5576c4d80c34285a4 /include/linux/blkdev.h | |
parent | cfa320f72882f0e944e2237287db84b0f7df877d (diff) | |
download | linux-5debd9691c3ac64c3acd6867c264ad38bbe48cdc.tar.xz |
block: introduce bdev_iter_is_aligned helper
Provide a convenient function for this repeatable coding pattern.
Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220610195830.3574005-10-kbusch@fb.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/blkdev.h')
-rw-r--r-- | include/linux/blkdev.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 2556fcdb645b..0b8bc1fe0b2c 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1370,6 +1370,13 @@ static inline unsigned int bdev_dma_alignment(struct block_device *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, unsigned int len) { |