[PATCH 6/9] io_uring: clean up io_poll_remove_waitqs()

Pavel Begunkov
2021-04-13T02:03:11Z

Move some parts of io_poll_remove_waitqs() that are opcode independent.
Looks better and stresses that both do __io_poll_remove_one().

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
fs/io_uring.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 4f4b4f4bff2d..4407ebc8f8d3 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -5224,21 +5224,16 @@ static bool io_poll_remove_waitqs(struct io_kiocb *req)
bool do_complete;

io_poll_remove_double(req);
+ do_complete = __io_poll_remove_one(req, io_poll_get_single(req), true);

- if (req->opcode == IORING_OP_POLL_ADD) {
- do_complete = __io_poll_remove_one(req, &req->poll, true);
- } else {
+ if (req->opcode != IORING_OP_POLL_ADD && do_complete) {
struct async_poll *apoll = req->apoll;

/* non-poll requests have submit ref still */
- do_complete = __io_poll_remove_one(req, &apoll->poll, true);
- if (do_complete) {
- req_ref_put(req);
- kfree(apoll->double_poll);
- kfree(apoll);
- }
+ req_ref_put(req);
+ kfree(apoll->double_poll);
+ kfree(apoll);
}
-
return do_complete;
}

--
2.24.0