Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

block: 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: Keith Busch <kbusch@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Keith Busch and committed by
Jens Axboe
5ff3f74e 20a0e627

+2 -2
+2 -2
block/fops.c
··· 38 38 static bool blkdev_dio_invalid(struct block_device *bdev, struct kiocb *iocb, 39 39 struct iov_iter *iter) 40 40 { 41 - return iocb->ki_pos & (bdev_logical_block_size(bdev) - 1) || 42 - !bdev_iter_is_aligned(bdev, iter); 41 + return (iocb->ki_pos | iov_iter_count(iter)) & 42 + (bdev_logical_block_size(bdev) - 1); 43 43 } 44 44 45 45 #define DIO_INLINE_BIO_VECS 4