Commit e27414be authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe

io_uring: refactor io_poll_complete()

Remove error parameter from io_poll_complete(), 0 is always passed,
and do a bit of cleaning on top.
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent f40b964a
...@@ -4894,18 +4894,19 @@ static void io_poll_remove_double(struct io_kiocb *req) ...@@ -4894,18 +4894,19 @@ static void io_poll_remove_double(struct io_kiocb *req)
} }
} }
static bool io_poll_complete(struct io_kiocb *req, __poll_t mask, int error) static bool io_poll_complete(struct io_kiocb *req, __poll_t mask)
__must_hold(&req->ctx->completion_lock) __must_hold(&req->ctx->completion_lock)
{ {
struct io_ring_ctx *ctx = req->ctx; struct io_ring_ctx *ctx = req->ctx;
unsigned flags = IORING_CQE_F_MORE; unsigned flags = IORING_CQE_F_MORE;
int error;
if (!error && req->poll.canceled) { if (READ_ONCE(req->poll.canceled)) {
error = -ECANCELED; error = -ECANCELED;
req->poll.events |= EPOLLONESHOT; req->poll.events |= EPOLLONESHOT;
} } else {
if (!error)
error = mangle_poll(mask); error = mangle_poll(mask);
}
if (req->poll.events & EPOLLONESHOT) if (req->poll.events & EPOLLONESHOT)
flags = 0; flags = 0;
if (!__io_cqring_fill_event(req, error, flags)) { if (!__io_cqring_fill_event(req, error, flags)) {
...@@ -4928,7 +4929,7 @@ static void io_poll_task_func(struct callback_head *cb) ...@@ -4928,7 +4929,7 @@ static void io_poll_task_func(struct callback_head *cb)
} else { } else {
bool done; bool done;
done = io_poll_complete(req, req->result, 0); done = io_poll_complete(req, req->result);
if (done) { if (done) {
hash_del(&req->hash_node); hash_del(&req->hash_node);
} else { } else {
...@@ -5414,7 +5415,7 @@ static int __io_poll_add(struct io_kiocb *req) ...@@ -5414,7 +5415,7 @@ static int __io_poll_add(struct io_kiocb *req)
if (mask) { /* no async, we'd stolen it */ if (mask) { /* no async, we'd stolen it */
ipt.error = 0; ipt.error = 0;
io_poll_complete(req, mask, 0); io_poll_complete(req, mask);
} }
spin_unlock_irq(&ctx->completion_lock); spin_unlock_irq(&ctx->completion_lock);
......
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