* [PATCH] io_uring: pass ctx instead of req to io_init_req_drain()
@ 2025-02-12 16:48 Caleb Sander Mateos
2025-02-12 18:16 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Caleb Sander Mateos @ 2025-02-12 16:48 UTC (permalink / raw)
To: Jens Axboe, Pavel Begunkov; +Cc: Caleb Sander Mateos, io-uring, linux-kernel
io_init_req_drain() takes a struct io_kiocb *req argument but only uses
it to get struct io_ring_ctx *ctx. The caller already knows the ctx, so
pass it instead.
Drop "req" from the function name since it operates on the ctx rather
than a specific req.
Signed-off-by: Caleb Sander Mateos <[email protected]>
---
io_uring/io_uring.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 8bb8c099c3e1..4a0944a57d96 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -1995,13 +1995,12 @@ static inline bool io_check_restriction(struct io_ring_ctx *ctx,
return false;
return true;
}
-static void io_init_req_drain(struct io_kiocb *req)
+static void io_init_drain(struct io_ring_ctx *ctx)
{
- struct io_ring_ctx *ctx = req->ctx;
struct io_kiocb *head = ctx->submit_state.link.head;
ctx->drain_active = true;
if (head) {
/*
@@ -2059,11 +2058,11 @@ static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req,
if (sqe_flags & IOSQE_CQE_SKIP_SUCCESS)
ctx->drain_disabled = true;
if (sqe_flags & IOSQE_IO_DRAIN) {
if (ctx->drain_disabled)
return io_init_fail_req(req, -EOPNOTSUPP);
- io_init_req_drain(req);
+ io_init_drain(ctx);
}
}
if (unlikely(ctx->restricted || ctx->drain_active || ctx->drain_next)) {
if (ctx->restricted && !io_check_restriction(ctx, req, sqe_flags))
return io_init_fail_req(req, -EACCES);
--
2.45.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] io_uring: pass ctx instead of req to io_init_req_drain()
2025-02-12 16:48 [PATCH] io_uring: pass ctx instead of req to io_init_req_drain() Caleb Sander Mateos
@ 2025-02-12 18:16 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2025-02-12 18:16 UTC (permalink / raw)
To: Pavel Begunkov, Caleb Sander Mateos; +Cc: io-uring, linux-kernel
On Wed, 12 Feb 2025 09:48:05 -0700, Caleb Sander Mateos wrote:
> io_init_req_drain() takes a struct io_kiocb *req argument but only uses
> it to get struct io_ring_ctx *ctx. The caller already knows the ctx, so
> pass it instead.
>
> Drop "req" from the function name since it operates on the ctx rather
> than a specific req.
>
> [...]
Applied, thanks!
[1/1] io_uring: pass ctx instead of req to io_init_req_drain()
commit: 5fa0beffc75910a694a90ed0425bb13674b10256
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-02-12 18:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-12 16:48 [PATCH] io_uring: pass ctx instead of req to io_init_req_drain() Caleb Sander Mateos
2025-02-12 18: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