]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
iomap: support ioends for direct reads
authorChristoph Hellwig <hch@lst.de>
Mon, 26 Jan 2026 05:53:44 +0000 (06:53 +0100)
committerJens Axboe <axboe@kernel.dk>
Wed, 28 Jan 2026 12:16:40 +0000 (05:16 -0700)
Support using the ioend structure to defer I/O completion for direct
reads in addition to writes.  This requires a check for the operation
to not merge reads and writes in iomap_ioend_can_merge.  This support
will be used for bounce buffered direct I/O reads that need to copy
data back to the user address space on read completion.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Tested-by: Anuj Gupta <anuj20.g@samsung.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/iomap/ioend.c

index 86f44922ed3b6a52ad1529bd69c9160ff52e8975..800d12f454380edee1aa5a481ffbe1aee858fcb4 100644 (file)
@@ -299,6 +299,14 @@ EXPORT_SYMBOL_GPL(iomap_finish_ioends);
 static bool iomap_ioend_can_merge(struct iomap_ioend *ioend,
                struct iomap_ioend *next)
 {
+       /*
+        * There is no point in merging reads as there is no completion
+        * processing that can be easily batched up for them.
+        */
+       if (bio_op(&ioend->io_bio) == REQ_OP_READ ||
+           bio_op(&next->io_bio) == REQ_OP_READ)
+               return false;
+
        if (ioend->io_bio.bi_status != next->io_bio.bi_status)
                return false;
        if (next->io_flags & IOMAP_IOEND_BOUNDARY)