提交 6f3b9878 编写于 作者: J Jens Axboe 提交者: Xiaoguang Wang

io_uring: cleanup io_poll_remove_one() logic

to #28736503

commit 3bfa5bcb26f0b52d7ae8416aa0618fff21aceaaf upstream

We only need apoll in the one section, do the juggling with the work
restoration there. This removes a special case further down as well.

No functional changes in this patch.
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Signed-off-by: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Acked-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
上级 3cd5e53f
...@@ -4347,32 +4347,31 @@ static bool __io_poll_remove_one(struct io_kiocb *req, ...@@ -4347,32 +4347,31 @@ static bool __io_poll_remove_one(struct io_kiocb *req,
do_complete = true; do_complete = true;
} }
spin_unlock(&poll->head->lock); spin_unlock(&poll->head->lock);
hash_del(&req->hash_node);
return do_complete; return do_complete;
} }
static bool io_poll_remove_one(struct io_kiocb *req) static bool io_poll_remove_one(struct io_kiocb *req)
{ {
struct async_poll *apoll = NULL;
bool do_complete; bool do_complete;
if (req->opcode == IORING_OP_POLL_ADD) { if (req->opcode == IORING_OP_POLL_ADD) {
do_complete = __io_poll_remove_one(req, &req->poll); do_complete = __io_poll_remove_one(req, &req->poll);
} else { } else {
apoll = req->apoll; struct async_poll *apoll = req->apoll;
/* non-poll requests have submit ref still */ /* non-poll requests have submit ref still */
do_complete = __io_poll_remove_one(req, &req->apoll->poll); do_complete = __io_poll_remove_one(req, &apoll->poll);
if (do_complete) if (do_complete) {
io_put_req(req); io_put_req(req);
} /*
* restore ->work because we will call
hash_del(&req->hash_node); * io_req_work_drop_env below when dropping the
* final reference.
if (do_complete && apoll) { */
/* memcpy(&req->work, &apoll->work, sizeof(req->work));
* restore ->work because we need to call io_req_work_drop_env. kfree(apoll);
*/ }
memcpy(&req->work, &apoll->work, sizeof(req->work));
kfree(apoll);
} }
if (do_complete) { if (do_complete) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册