Skip to content

Commit d969bd7

Browse files
Christoph Hellwigaxboe
authored andcommitted
iomap: support ioends for direct reads
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>
1 parent c96b8b2 commit d969bd7

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

fs/iomap/ioend.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,14 @@ EXPORT_SYMBOL_GPL(iomap_finish_ioends);
299299
static bool iomap_ioend_can_merge(struct iomap_ioend *ioend,
300300
struct iomap_ioend *next)
301301
{
302+
/*
303+
* There is no point in merging reads as there is no completion
304+
* processing that can be easily batched up for them.
305+
*/
306+
if (bio_op(&ioend->io_bio) == REQ_OP_READ ||
307+
bio_op(&next->io_bio) == REQ_OP_READ)
308+
return false;
309+
302310
if (ioend->io_bio.bi_status != next->io_bio.bi_status)
303311
return false;
304312
if (next->io_flags & IOMAP_IOEND_BOUNDARY)

0 commit comments

Comments
 (0)