Commit 7819a1f6 authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe

io_uring: refactor io_req_find_next

Move the fast path from io_req_find_next() into callers. It prepares us
for further changes.
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/10bd0e564472dde0c7f8d90ae317d05356cd565a.1647897811.git.asml.silence@gmail.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 60053be8
...@@ -2370,8 +2370,6 @@ static inline struct io_kiocb *io_req_find_next(struct io_kiocb *req) ...@@ -2370,8 +2370,6 @@ static inline struct io_kiocb *io_req_find_next(struct io_kiocb *req)
{ {
struct io_kiocb *nxt; struct io_kiocb *nxt;
if (likely(!(req->flags & (REQ_F_LINK|REQ_F_HARDLINK))))
return NULL;
/* /*
* If LINK is set, we have dependent requests in this chain. If we * If LINK is set, we have dependent requests in this chain. If we
* didn't fail this request, queue the first one up, moving any other * didn't fail this request, queue the first one up, moving any other
...@@ -2598,10 +2596,12 @@ static void io_req_task_queue_reissue(struct io_kiocb *req) ...@@ -2598,10 +2596,12 @@ static void io_req_task_queue_reissue(struct io_kiocb *req)
static inline void io_queue_next(struct io_kiocb *req) static inline void io_queue_next(struct io_kiocb *req)
{ {
if (unlikely(req->flags & (REQ_F_LINK|REQ_F_HARDLINK))) {
struct io_kiocb *nxt = io_req_find_next(req); struct io_kiocb *nxt = io_req_find_next(req);
if (nxt) if (nxt)
io_req_task_queue(nxt); io_req_task_queue(nxt);
}
} }
static void io_free_req(struct io_kiocb *req) static void io_free_req(struct io_kiocb *req)
...@@ -2695,6 +2695,7 @@ static inline struct io_kiocb *io_put_req_find_next(struct io_kiocb *req) ...@@ -2695,6 +2695,7 @@ static inline struct io_kiocb *io_put_req_find_next(struct io_kiocb *req)
struct io_kiocb *nxt = NULL; struct io_kiocb *nxt = NULL;
if (req_ref_put_and_test(req)) { if (req_ref_put_and_test(req)) {
if (unlikely(req->flags & (REQ_F_LINK|REQ_F_HARDLINK)))
nxt = io_req_find_next(req); nxt = io_req_find_next(req);
__io_free_req(req); __io_free_req(req);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment