Skip to content

Commit bf8d085

Browse files
keithbuschaxboe
authored andcommitted
iomap: add support for dma aligned direct-io
Use the address alignment requirements from the block_device for direct io instead of requiring addresses be aligned to the block size. Signed-off-by: Keith Busch <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent b1a000d commit bf8d085

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/iomap/direct-io.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@ static loff_t iomap_dio_bio_iter(const struct iomap_iter *iter,
242242
struct inode *inode = iter->inode;
243243
unsigned int blkbits = blksize_bits(bdev_logical_block_size(iomap->bdev));
244244
unsigned int fs_block_size = i_blocksize(inode), pad;
245-
unsigned int align = iov_iter_alignment(dio->submit.iter);
246245
loff_t length = iomap_length(iter);
247246
loff_t pos = iter->pos;
248247
unsigned int bio_opf;
@@ -253,7 +252,8 @@ static loff_t iomap_dio_bio_iter(const struct iomap_iter *iter,
253252
size_t copied = 0;
254253
size_t orig_count;
255254

256-
if ((pos | length | align) & ((1 << blkbits) - 1))
255+
if ((pos | length) & ((1 << blkbits) - 1) ||
256+
!bdev_iter_is_aligned(iomap->bdev, dio->submit.iter))
257257
return -EINVAL;
258258

259259
if (iomap->type == IOMAP_UNWRITTEN) {

0 commit comments

Comments
 (0)