Commit 7eac3318 authored by Keith Busch's avatar Keith Busch Committed by Jens Axboe
Browse files

iomap: simplify direct io validity check



The block layer checks all the segments for validity later, so no need
for an early check. Just reduce it to a simple position and total length
check, and defer the more invasive segment checks to the block layer.

Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 5ff3f74e
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -337,8 +337,7 @@ static int iomap_dio_bio_iter(struct iomap_iter *iter, struct iomap_dio *dio)
	u64 copied = 0;
	size_t orig_count;

	if ((pos | length) & (bdev_logical_block_size(iomap->bdev) - 1) ||
	    !bdev_iter_is_aligned(iomap->bdev, dio->submit.iter))
	if ((pos | length) & (bdev_logical_block_size(iomap->bdev) - 1))
		return -EINVAL;

	if (dio->flags & IOMAP_DIO_WRITE) {