提交 fe98f16c 编写于 作者: J Jackie Liu 提交者: Shile Zhang

io_uring: separate the io_free_req and io_free_req_find_next interface

commit c69f8dbe2426cbf6150407b7e86ce85bb463c1dc upstream.

Similar to the distinction between io_put_req and io_put_req_find_next,
io_free_req has been modified similarly, with no functional changes.
Signed-off-by: NJackie Liu <liuyun01@kylinos.cn>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Signed-off-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
Reviewed-by: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
上级 239ccc59
...@@ -882,7 +882,7 @@ static void io_fail_links(struct io_kiocb *req) ...@@ -882,7 +882,7 @@ static void io_fail_links(struct io_kiocb *req)
io_cqring_ev_posted(ctx); io_cqring_ev_posted(ctx);
} }
static void io_free_req(struct io_kiocb *req, struct io_kiocb **nxt) static void io_free_req_find_next(struct io_kiocb *req, struct io_kiocb **nxt)
{ {
if (likely(!(req->flags & REQ_F_LINK))) { if (likely(!(req->flags & REQ_F_LINK))) {
__io_free_req(req); __io_free_req(req);
...@@ -916,6 +916,11 @@ static void io_free_req(struct io_kiocb *req, struct io_kiocb **nxt) ...@@ -916,6 +916,11 @@ static void io_free_req(struct io_kiocb *req, struct io_kiocb **nxt)
__io_free_req(req); __io_free_req(req);
} }
static void io_free_req(struct io_kiocb *req)
{
io_free_req_find_next(req, NULL);
}
/* /*
* Drop reference to request, return next in chain (if there is one) if this * Drop reference to request, return next in chain (if there is one) if this
* was the last reference to this request. * was the last reference to this request.
...@@ -925,7 +930,7 @@ static void io_put_req_find_next(struct io_kiocb *req, struct io_kiocb **nxtptr) ...@@ -925,7 +930,7 @@ static void io_put_req_find_next(struct io_kiocb *req, struct io_kiocb **nxtptr)
struct io_kiocb *nxt = NULL; struct io_kiocb *nxt = NULL;
if (refcount_dec_and_test(&req->refs)) if (refcount_dec_and_test(&req->refs))
io_free_req(req, &nxt); io_free_req_find_next(req, &nxt);
if (nxt) { if (nxt) {
if (nxtptr) if (nxtptr)
...@@ -938,7 +943,7 @@ static void io_put_req_find_next(struct io_kiocb *req, struct io_kiocb **nxtptr) ...@@ -938,7 +943,7 @@ static void io_put_req_find_next(struct io_kiocb *req, struct io_kiocb **nxtptr)
static void io_put_req(struct io_kiocb *req) static void io_put_req(struct io_kiocb *req)
{ {
if (refcount_dec_and_test(&req->refs)) if (refcount_dec_and_test(&req->refs))
io_free_req(req, NULL); io_free_req(req);
} }
static void io_double_put_req(struct io_kiocb *req) static void io_double_put_req(struct io_kiocb *req)
...@@ -1005,7 +1010,7 @@ static void io_iopoll_complete(struct io_ring_ctx *ctx, unsigned int *nr_events, ...@@ -1005,7 +1010,7 @@ static void io_iopoll_complete(struct io_ring_ctx *ctx, unsigned int *nr_events,
if (to_free == ARRAY_SIZE(reqs)) if (to_free == ARRAY_SIZE(reqs))
io_free_req_many(ctx, reqs, &to_free); io_free_req_many(ctx, reqs, &to_free);
} else { } else {
io_free_req(req, NULL); io_free_req(req);
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册