Skip to content

Commit 247f97a

Browse files
isilenceaxboe
authored andcommitted
io_uring: open code io_put_req_find_next
There is only one user of io_put_req_find_next() and it doesn't make much sense to have it. Open code the function. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/38b5c5e48e4adc8e6a0cd16fdd5c1531d7ff81a9.1687518903.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 4bfb0c9 commit 247f97a

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

io_uring/io_uring.c

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1586,22 +1586,6 @@ static void __io_submit_flush_completions(struct io_ring_ctx *ctx)
15861586
}
15871587
}
15881588

1589-
/*
1590-
* Drop reference to request, return next in chain (if there is one) if this
1591-
* was the last reference to this request.
1592-
*/
1593-
static inline struct io_kiocb *io_put_req_find_next(struct io_kiocb *req)
1594-
{
1595-
struct io_kiocb *nxt = NULL;
1596-
1597-
if (req_ref_put_and_test(req)) {
1598-
if (unlikely(req->flags & IO_REQ_LINK_FLAGS))
1599-
nxt = io_req_find_next(req);
1600-
io_free_req(req);
1601-
}
1602-
return nxt;
1603-
}
1604-
16051589
static unsigned io_cqring_events(struct io_ring_ctx *ctx)
16061590
{
16071591
/* See comment at the top of this file */
@@ -1954,9 +1938,14 @@ int io_poll_issue(struct io_kiocb *req, struct io_tw_state *ts)
19541938
struct io_wq_work *io_wq_free_work(struct io_wq_work *work)
19551939
{
19561940
struct io_kiocb *req = container_of(work, struct io_kiocb, work);
1941+
struct io_kiocb *nxt = NULL;
19571942

1958-
req = io_put_req_find_next(req);
1959-
return req ? &req->work : NULL;
1943+
if (req_ref_put_and_test(req)) {
1944+
if (req->flags & IO_REQ_LINK_FLAGS)
1945+
nxt = io_req_find_next(req);
1946+
io_free_req(req);
1947+
}
1948+
return nxt ? &nxt->work : NULL;
19601949
}
19611950

19621951
void io_wq_submit_work(struct io_wq_work *work)

0 commit comments

Comments
 (0)