Skip to content

Commit 7b3c14d

Browse files
committed
iomap: add IOMAP_DIO_INLINE_COMP
Rather than gate whether or not we need to punt a dio completion to a workqueue on whether the IO is a write or not, add an explicit flag for it. For now we treat them the same, reads always set the flags and async writes do not. No functional changes in this patch. Reviewed-by: Darrick J. Wong <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Dave Chinner <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent daa99c5 commit 7b3c14d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

fs/iomap/direct-io.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* Private flags for iomap_dio, must not overlap with the public ones in
2121
* iomap.h:
2222
*/
23+
#define IOMAP_DIO_INLINE_COMP (1U << 27)
2324
#define IOMAP_DIO_WRITE_THROUGH (1U << 28)
2425
#define IOMAP_DIO_NEED_SYNC (1U << 29)
2526
#define IOMAP_DIO_WRITE (1U << 30)
@@ -172,8 +173,10 @@ void iomap_dio_bio_end_io(struct bio *bio)
172173
goto release_bio;
173174
}
174175

175-
/* Read completion can always complete inline. */
176-
if (!(dio->flags & IOMAP_DIO_WRITE)) {
176+
/*
177+
* Flagged with IOMAP_DIO_INLINE_COMP, we can complete it inline
178+
*/
179+
if (dio->flags & IOMAP_DIO_INLINE_COMP) {
177180
WRITE_ONCE(iocb->private, NULL);
178181
iomap_dio_complete_work(&dio->aio.work);
179182
goto release_bio;
@@ -528,6 +531,9 @@ __iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
528531
iomi.flags |= IOMAP_NOWAIT;
529532

530533
if (iov_iter_rw(iter) == READ) {
534+
/* reads can always complete inline */
535+
dio->flags |= IOMAP_DIO_INLINE_COMP;
536+
531537
if (iomi.pos >= dio->i_size)
532538
goto out_free_dio;
533539

0 commit comments

Comments
 (0)