public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] io_uring: move io_req_put_rsrc_nodes()
@ 2025-05-06 12:31 Pavel Begunkov
  2025-05-06 13:48 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2025-05-06 12:31 UTC (permalink / raw)
  To: io-uring; +Cc: asml.silence

It'd be nice to hide details of how rsrc nodes are used by a request
from rsrc.c, specifically which request fields store them, and what bits
are signifying if there is a node in a request. It rather belong to
generic request handling, so move the helper to io_uring.c. While doing
so remove clearing of ->buf_node as it's controlled by REQ_F_BUF_NODE
and doesn't require zeroing.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 io_uring/io_uring.c | 10 ++++++++++
 io_uring/rsrc.h     | 12 ------------
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 3d20f3b63443..0d051476008c 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -1369,6 +1369,16 @@ void io_queue_next(struct io_kiocb *req)
 		io_req_task_queue(nxt);
 }
 
+static inline void io_req_put_rsrc_nodes(struct io_kiocb *req)
+{
+	if (req->file_node) {
+		io_put_rsrc_node(req->ctx, req->file_node);
+		req->file_node = NULL;
+	}
+	if (req->flags & REQ_F_BUF_NODE)
+		io_put_rsrc_node(req->ctx, req->buf_node);
+}
+
 static void io_free_batch_list(struct io_ring_ctx *ctx,
 			       struct io_wq_work_node *node)
 	__must_hold(&ctx->uring_lock)
diff --git a/io_uring/rsrc.h b/io_uring/rsrc.h
index 2818aa0d0472..0d2138f16322 100644
--- a/io_uring/rsrc.h
+++ b/io_uring/rsrc.h
@@ -115,18 +115,6 @@ static inline bool io_reset_rsrc_node(struct io_ring_ctx *ctx,
 	return true;
 }
 
-static inline void io_req_put_rsrc_nodes(struct io_kiocb *req)
-{
-	if (req->file_node) {
-		io_put_rsrc_node(req->ctx, req->file_node);
-		req->file_node = NULL;
-	}
-	if (req->flags & REQ_F_BUF_NODE) {
-		io_put_rsrc_node(req->ctx, req->buf_node);
-		req->buf_node = NULL;
-	}
-}
-
 int io_files_update(struct io_kiocb *req, unsigned int issue_flags);
 int io_files_update_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
 
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] io_uring: move io_req_put_rsrc_nodes()
  2025-05-06 12:31 [PATCH 1/1] io_uring: move io_req_put_rsrc_nodes() Pavel Begunkov
@ 2025-05-06 13:48 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2025-05-06 13:48 UTC (permalink / raw)
  To: io-uring, Pavel Begunkov


On Tue, 06 May 2025 13:31:16 +0100, Pavel Begunkov wrote:
> It'd be nice to hide details of how rsrc nodes are used by a request
> from rsrc.c, specifically which request fields store them, and what bits
> are signifying if there is a node in a request. It rather belong to
> generic request handling, so move the helper to io_uring.c. While doing
> so remove clearing of ->buf_node as it's controlled by REQ_F_BUF_NODE
> and doesn't require zeroing.
> 
> [...]

Applied, thanks!

[1/1] io_uring: move io_req_put_rsrc_nodes()
      commit: 9c4dfa5b0c0256661a6a9d26729ce01e725918c4

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-05-06 13:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-06 12:31 [PATCH 1/1] io_uring: move io_req_put_rsrc_nodes() Pavel Begunkov
2025-05-06 13:48 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox