From: Anuj Gupta <anuj20.g@samsung.com>
To: io-uring@vger.kernel.org, anuj1072538@gmail.com, axboe@kernel.dk,
asml.silence@gmail.com
Cc: joshi.k@samsung.com, Anuj Gupta <anuj20.g@samsung.com>
Subject: [PATCH liburing] test/io_uring_passthrough: remove io_uring_prep_read/write*() helpers
Date: Wed, 21 May 2025 18:06:43 +0530 [thread overview]
Message-ID: <20250521123643.4793-1-anuj20.g@samsung.com> (raw)
In-Reply-To: CGME20250521125340epcas5p44d0f9a187e59ded5975323dc3017a8e3@epcas5p4.samsung.com
io_uring passthrough doesn't require setting the rw fields of the SQE.
So get rid of them, and just set the required fields.
Suggested-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
---
test/io_uring_passthrough.c | 61 +++++++++----------------------------
1 file changed, 15 insertions(+), 46 deletions(-)
diff --git a/test/io_uring_passthrough.c b/test/io_uring_passthrough.c
index 66c97da..b62eccf 100644
--- a/test/io_uring_passthrough.c
+++ b/test/io_uring_passthrough.c
@@ -74,7 +74,7 @@ static int __test_io(const char *file, struct io_uring *ring, int tc, int read,
struct nvme_uring_cmd *cmd;
int open_flags;
int do_fixed;
- int i, ret, fd = -1;
+ int i, ret, fd = -1, use_fd = -1;
off_t offset;
__u64 slba;
__u32 nlb;
@@ -120,53 +120,22 @@ static int __test_io(const char *file, struct io_uring *ring, int tc, int read,
fprintf(stderr, "sqe get failed\n");
goto err;
}
- if (read) {
- int use_fd = fd;
-
- do_fixed = fixed;
-
- if (sqthread)
- use_fd = 0;
- if (fixed && (i & 1))
- do_fixed = 0;
- if (do_fixed) {
- io_uring_prep_read_fixed(sqe, use_fd, vecs[i].iov_base,
- vecs[i].iov_len,
- offset, i);
- sqe->cmd_op = NVME_URING_CMD_IO;
- } else if (nonvec) {
- io_uring_prep_read(sqe, use_fd, vecs[i].iov_base,
- vecs[i].iov_len, offset);
- sqe->cmd_op = NVME_URING_CMD_IO;
- } else {
- io_uring_prep_readv(sqe, use_fd, &vecs[i], 1,
- offset);
- sqe->cmd_op = NVME_URING_CMD_IO_VEC;
- }
+ use_fd = fd;
+ do_fixed = fixed;
+
+ if (sqthread)
+ use_fd = 0;
+ if (fixed && (i & 1))
+ do_fixed = 0;
+ if (do_fixed) {
+ sqe->buf_index = i;
+ sqe->cmd_op = NVME_URING_CMD_IO;
+ } else if (nonvec) {
+ sqe->cmd_op = NVME_URING_CMD_IO;
} else {
- int use_fd = fd;
-
- do_fixed = fixed;
-
- if (sqthread)
- use_fd = 0;
- if (fixed && (i & 1))
- do_fixed = 0;
- if (do_fixed) {
- io_uring_prep_write_fixed(sqe, use_fd, vecs[i].iov_base,
- vecs[i].iov_len,
- offset, i);
- sqe->cmd_op = NVME_URING_CMD_IO;
- } else if (nonvec) {
- io_uring_prep_write(sqe, use_fd, vecs[i].iov_base,
- vecs[i].iov_len, offset);
- sqe->cmd_op = NVME_URING_CMD_IO;
- } else {
- io_uring_prep_writev(sqe, use_fd, &vecs[i], 1,
- offset);
- sqe->cmd_op = NVME_URING_CMD_IO_VEC;
- }
+ sqe->cmd_op = NVME_URING_CMD_IO_VEC;
}
+ sqe->fd = use_fd;
sqe->opcode = IORING_OP_URING_CMD;
if (do_fixed)
sqe->uring_cmd_flags |= IORING_URING_CMD_FIXED;
--
2.25.1
next parent reply other threads:[~2025-05-21 13:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20250521125340epcas5p44d0f9a187e59ded5975323dc3017a8e3@epcas5p4.samsung.com>
2025-05-21 12:36 ` Anuj Gupta [this message]
2025-05-21 13:10 ` [PATCH liburing] test/io_uring_passthrough: remove io_uring_prep_read/write*() helpers Jens Axboe
2025-05-21 13:12 ` Anuj gupta
[not found] <CGME20250521134959epcas5p412e2aac9e57ccda2e81b416d5171a53b@epcas5p4.samsung.com>
2025-05-21 13:33 ` Anuj Gupta
2025-05-21 14:16 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250521123643.4793-1-anuj20.g@samsung.com \
--to=anuj20.g@samsung.com \
--cc=anuj1072538@gmail.com \
--cc=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=io-uring@vger.kernel.org \
--cc=joshi.k@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox