diff options
author | Keith Busch <kbusch@kernel.org> | 2022-06-10 21:58:29 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-06-27 14:29:11 +0200 |
commit | b1a000d3b8ec582da64bb644be633e5a0beffcbf (patch) | |
tree | 960fc00a20dbe8733f847f441205dae3be20b189 /block/fops.c | |
parent | block: introduce bdev_iter_is_aligned helper (diff) | |
download | linux-b1a000d3b8ec582da64bb644be633e5a0beffcbf.tar.xz linux-b1a000d3b8ec582da64bb644be633e5a0beffcbf.zip |
block: relax direct io memory alignment
Use the address alignment requirements from the block_device for direct
io instead of requiring addresses be aligned to the block size. User
space can discover the alignment requirements from the dma_alignment
queue attribute.
User space can specify any hardware compatible DMA offset for each
segment, but every segment length is still required to be a multiple of
the block size.
Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220610195830.3574005-11-kbusch@fb.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/fops.c')
-rw-r--r-- | block/fops.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/block/fops.c b/block/fops.c index 9d32df6fc315..86d3cab9bf93 100644 --- a/block/fops.c +++ b/block/fops.c @@ -45,8 +45,8 @@ static unsigned int dio_bio_write_op(struct kiocb *iocb) static bool blkdev_dio_unaligned(struct block_device *bdev, loff_t pos, struct iov_iter *iter) { - return ((pos | iov_iter_alignment(iter)) & - (bdev_logical_block_size(bdev) - 1)); + return pos & (bdev_logical_block_size(bdev) - 1) || + !bdev_iter_is_aligned(bdev, iter); } #define DIO_INLINE_BIO_VECS 4 |