* [PATCH liburing] test/io_uring_passthrough: remove io_uring_prep_read/write*() helpers
[not found] <CGME20250521125340epcas5p44d0f9a187e59ded5975323dc3017a8e3@epcas5p4.samsung.com>
@ 2025-05-21 12:36 ` Anuj Gupta
2025-05-21 13:10 ` Jens Axboe
0 siblings, 1 reply; 5+ messages in thread
From: Anuj Gupta @ 2025-05-21 12:36 UTC (permalink / raw)
To: io-uring, anuj1072538, axboe, asml.silence; +Cc: joshi.k, Anuj Gupta
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH liburing] test/io_uring_passthrough: remove io_uring_prep_read/write*() helpers
2025-05-21 12:36 ` [PATCH liburing] test/io_uring_passthrough: remove io_uring_prep_read/write*() helpers Anuj Gupta
@ 2025-05-21 13:10 ` Jens Axboe
2025-05-21 13:12 ` Anuj gupta
0 siblings, 1 reply; 5+ messages in thread
From: Jens Axboe @ 2025-05-21 13:10 UTC (permalink / raw)
To: Anuj Gupta, io-uring, anuj1072538, asml.silence; +Cc: joshi.k
On 5/21/25 6:36 AM, Anuj Gupta wrote:
> io_uring passthrough doesn't require setting the rw fields of the SQE.
> So get rid of them, and just set the required fields.
This conflicts with the patch you just sent...
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH liburing] test/io_uring_passthrough: remove io_uring_prep_read/write*() helpers
2025-05-21 13:10 ` Jens Axboe
@ 2025-05-21 13:12 ` Anuj gupta
0 siblings, 0 replies; 5+ messages in thread
From: Anuj gupta @ 2025-05-21 13:12 UTC (permalink / raw)
To: Jens Axboe; +Cc: Anuj Gupta, io-uring, asml.silence, joshi.k
On Wed, May 21, 2025 at 6:40 PM Jens Axboe <axboe@kernel.dk> wrote:
>
> On 5/21/25 6:36 AM, Anuj Gupta wrote:
> > io_uring passthrough doesn't require setting the rw fields of the SQE.
> > So get rid of them, and just set the required fields.
>
> This conflicts with the patch you just sent...
Right, I will resend after rebasing on top of latest. Sorry for the noise.
>
> --
> Jens Axboe
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH liburing] test/io_uring_passthrough: remove io_uring_prep_read/write*() helpers
[not found] <CGME20250521134959epcas5p412e2aac9e57ccda2e81b416d5171a53b@epcas5p4.samsung.com>
@ 2025-05-21 13:33 ` Anuj Gupta
2025-05-21 14:16 ` Jens Axboe
0 siblings, 1 reply; 5+ messages in thread
From: Anuj Gupta @ 2025-05-21 13:33 UTC (permalink / raw)
To: io-uring, anuj1072538, axboe, asml.silence; +Cc: joshi.k, Anuj Gupta
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 | 71 ++++++++-----------------------------
1 file changed, 15 insertions(+), 56 deletions(-)
diff --git a/test/io_uring_passthrough.c b/test/io_uring_passthrough.c
index 4a0ad73..74bbfe0 100644
--- a/test/io_uring_passthrough.c
+++ b/test/io_uring_passthrough.c
@@ -75,7 +75,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;
@@ -121,61 +121,20 @@ 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 && nonvec) {
- 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 (do_fixed) {
- io_uring_prep_readv_fixed(sqe, use_fd, &vecs[i],
- 1, offset, 0, i);
- sqe->cmd_op = NVME_URING_CMD_IO_VEC;
- } 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;
- }
- } else {
- int use_fd = fd;
-
- do_fixed = fixed;
-
- if (sqthread)
- use_fd = 0;
- if (fixed && (i & 1))
- do_fixed = 0;
- if (do_fixed && nonvec) {
- 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 (do_fixed) {
- io_uring_prep_writev_fixed(sqe, use_fd, &vecs[i],
- 1, offset, 0, i);
- sqe->cmd_op = NVME_URING_CMD_IO_VEC;
- } 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;
- }
- }
+ 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;
+ if (nonvec)
+ sqe->cmd_op = NVME_URING_CMD_IO;
+ else
+ 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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH liburing] test/io_uring_passthrough: remove io_uring_prep_read/write*() helpers
2025-05-21 13:33 ` Anuj Gupta
@ 2025-05-21 14:16 ` Jens Axboe
0 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2025-05-21 14:16 UTC (permalink / raw)
To: io-uring, anuj1072538, asml.silence, Anuj Gupta; +Cc: joshi.k
On Wed, 21 May 2025 19:03:03 +0530, Anuj Gupta wrote:
> io_uring passthrough doesn't require setting the rw fields of the SQE.
> So get rid of them, and just set the required fields.
>
>
Applied, thanks!
[1/1] test/io_uring_passthrough: remove io_uring_prep_read/write*() helpers
commit: cce587856d39bc589286342830a2686fac174feb
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-05-21 14:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20250521125340epcas5p44d0f9a187e59ded5975323dc3017a8e3@epcas5p4.samsung.com>
2025-05-21 12:36 ` [PATCH liburing] test/io_uring_passthrough: remove io_uring_prep_read/write*() helpers Anuj Gupta
2025-05-21 13:10 ` 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).