]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
io_uring: move io_req_put_rsrc_nodes()
authorPavel Begunkov <asml.silence@gmail.com>
Tue, 6 May 2025 12:31:16 +0000 (13:31 +0100)
committerJens Axboe <axboe@kernel.dk>
Tue, 6 May 2025 16:11:23 +0000 (10:11 -0600)
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>
Link: https://lore.kernel.org/r/bb73fb42baf825edb39344365aff48cdfdd4c692.1746533789.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/io_uring.c
io_uring/rsrc.h

index 3d20f3b63443c66c2dcaa534d0bebb067cb49097..0d051476008c70c6e93b36a3db49c8baf9eb58a8 100644 (file)
@@ -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)
index 2818aa0d04722c9b2bbbd6088ec951928fb58d5c..0d2138f16322b21662034a029f905bd1b3159ee4 100644 (file)
@@ -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);