Commit 1ac57128 authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe
Browse files

io_uring/rsrc: don't skip offset calculation



Don't optimise for requests with offset=0. Large registered buffers are
the preference and hence the user is likely to pass an offset, and the
adjustments are not expensive and will be made even cheaper in following
patches.

Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/1c2beb20470ee3c886a363d4d8340d3790db19f3.1744882081.git.asml.silence@gmail.com


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 70e4f9bf
Loading
Loading
Loading
Loading
+37 −38
Original line number Diff line number Diff line
@@ -1036,6 +1036,7 @@ static int io_import_fixed(int ddir, struct iov_iter *iter,
			   struct io_mapped_ubuf *imu,
			   u64 buf_addr, size_t len)
{
	const struct bio_vec *bvec;
	size_t offset;
	int ret;

@@ -1054,7 +1055,6 @@ static int io_import_fixed(int ddir, struct iov_iter *iter,
	offset = buf_addr - imu->ubuf;
	iov_iter_bvec(iter, ddir, imu->bvec, imu->nr_bvecs, offset + len);

	if (offset) {
	/*
	 * Don't use iov_iter_advance() here, as it's really slow for
	 * using the latter parts of a big fixed buffer - it iterates
@@ -1071,7 +1071,7 @@ static int io_import_fixed(int ddir, struct iov_iter *iter,
	 * since we can just skip the first segment, which may not
	 * be folio_size aligned.
	 */
		const struct bio_vec *bvec = imu->bvec;
	bvec = imu->bvec;

	/*
	 * Kernel buffer bvecs, on the other hand, don't necessarily
@@ -1095,7 +1095,6 @@ static int io_import_fixed(int ddir, struct iov_iter *iter,
		iter->count -= bvec->bv_len + offset;
		iter->iov_offset = offset & ((1UL << imu->folio_shift) - 1);
	}
	}

	return 0;
}