[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250827141258.63501-5-kbusch@meta.com>
Date: Wed, 27 Aug 2025 07:12:54 -0700
From: Keith Busch <kbusch@...a.com>
To: <linux-block@...r.kernel.org>, <linux-fsdevel@...r.kernel.org>
CC: <linux-xfs@...r.kernel.org>, <linux-ext4@...r.kernel.org>, <hch@....de>,
<axboe@...nel.dk>, Keith Busch <kbusch@...nel.org>,
Hannes Reinecke
<hare@...e.de>,
"Martin K. Petersen" <martin.petersen@...cle.com>
Subject: [PATCHv4 4/8] block: simplify direct io validity check
From: Keith Busch <kbusch@...nel.org>
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@...nel.org>
Reviewed-by: Hannes Reinecke <hare@...e.de>
Reviewed-by: Martin K. Petersen <martin.petersen@...cle.com>
Reviewed-by: Christoph Hellwig <hch@....de>
---
block/fops.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/fops.c b/block/fops.c
index d136fb5f6b6ab..19814bddd77e2 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
--
2.47.3
Powered by blists - more mailing lists