Commit eb4b9cde authored by Jens Axboe's avatar Jens Axboe Committed by Zhihao Cheng
Browse files

iomap: add IOMAP_DIO_INLINE_COMP

mainline inclusion
from mainline-v6.6-rc1
commit 7b3c14d1
category: perf
bugzilla: https://gitee.com/openeuler/kernel/issues/I90ZB5
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7b3c14d1a96bf63c078c3bbfe5573fb964e80b95



--------------------------------

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: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
Conflicts:
	fs/iomap/direct-io.c
	[ 3a0be38c("iomap: treat a write through cache the same
	  as FUA") is not applied.
	  a6d3d495("iomap: switch __iomap_dio_rw to use iomap_iter")
	  is not applied. ]
Signed-off-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
parent d28aa030
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
 * Private flags for iomap_dio, must not overlap with the public ones in
 * iomap.h:
 */
#define IOMAP_DIO_INLINE_COMP	(1U << 27)
#define IOMAP_DIO_WRITE_FUA	(1U << 28)
#define IOMAP_DIO_NEED_SYNC	(1U << 29)
#define IOMAP_DIO_WRITE		(1U << 30)
@@ -173,8 +174,10 @@ static void iomap_dio_bio_end_io(struct bio *bio)
		goto release_bio;
	}

	/* Read completion can always complete inline. */
	if (!(dio->flags & IOMAP_DIO_WRITE)) {
	/*
	 * Flagged with IOMAP_DIO_INLINE_COMP, we can complete it inline
	 */
	if (dio->flags & IOMAP_DIO_INLINE_COMP) {
		iomap_dio_complete_work(&dio->aio.work);
		goto release_bio;
	}
@@ -471,6 +474,9 @@ __iomap_dio_rw(struct kiocb *iocb, struct iov_iter *iter,
	dio->submit.last_queue = NULL;

	if (iov_iter_rw(iter) == READ) {
		/* reads can always complete inline */
		dio->flags |= IOMAP_DIO_INLINE_COMP;

		if (pos >= dio->i_size)
			goto out_free_dio;