diff options
| author | Keith Busch <kbusch@kernel.org> | 2025-08-27 07:12:54 -0700 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2025-09-09 10:27:01 -0600 |
| commit | 5ff3f74e145adc79b49668adb8de276446acf6be (patch) | |
| tree | 3e27ecc0311ea44c2b69dcdb3a8730d6d2f19ea0 | |
| parent | 20a0e6276edba4318c13486df02c31e5f3c09431 (diff) | |
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>
| -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 d136fb5f6b6a..19814bddd77e 100644 --- a/block/fops.c +++ b/block/fops.c @@ -38,8 +38,8 @@ static blk_opf_t dio_bio_write_op(struct kiocb *iocb) static bool blkdev_dio_invalid(struct block_device *bdev, struct kiocb *iocb, struct iov_iter *iter) { - return iocb->ki_pos & (bdev_logical_block_size(bdev) - 1) || - !bdev_iter_is_aligned(bdev, iter); + return (iocb->ki_pos | iov_iter_count(iter)) & + (bdev_logical_block_size(bdev) - 1); } #define DIO_INLINE_BIO_VECS 4 |
