Skip to content

Commit 1947ddf

Browse files
committed
io_uring/poll: don't pass in wake func to io_init_poll_iocb()
We only use one, and it's io_poll_wake(). Hardwire that in the initial init, as well as in __io_queue_proc() if we're setting up for double poll. Signed-off-by: Jens Axboe <[email protected]>
1 parent 54aa7f2 commit 1947ddf

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

io_uring/poll.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ struct io_poll_table {
5151

5252
#define IO_WQE_F_DOUBLE 1
5353

54+
static int io_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync,
55+
void *key);
56+
5457
static inline struct io_kiocb *wqe_to_req(struct wait_queue_entry *wqe)
5558
{
5659
unsigned long priv = (unsigned long)wqe->private;
@@ -164,15 +167,14 @@ static void io_poll_tw_hash_eject(struct io_kiocb *req, bool *locked)
164167
}
165168
}
166169

167-
static void io_init_poll_iocb(struct io_poll *poll, __poll_t events,
168-
wait_queue_func_t wake_func)
170+
static void io_init_poll_iocb(struct io_poll *poll, __poll_t events)
169171
{
170172
poll->head = NULL;
171173
#define IO_POLL_UNMASK (EPOLLERR|EPOLLHUP|EPOLLNVAL|EPOLLRDHUP)
172174
/* mask in events that we always want/need */
173175
poll->events = events | IO_POLL_UNMASK;
174176
INIT_LIST_HEAD(&poll->wait.entry);
175-
init_waitqueue_func_entry(&poll->wait, wake_func);
177+
init_waitqueue_func_entry(&poll->wait, io_poll_wake);
176178
}
177179

178180
static inline void io_poll_remove_entry(struct io_poll *poll)
@@ -508,7 +510,7 @@ static void __io_queue_proc(struct io_poll *poll, struct io_poll_table *pt,
508510

509511
/* mark as double wq entry */
510512
wqe_private |= IO_WQE_F_DOUBLE;
511-
io_init_poll_iocb(poll, first->events, first->wait.func);
513+
io_init_poll_iocb(poll, first->events);
512514
if (!io_poll_double_prepare(req)) {
513515
/* the request is completing, just back off */
514516
kfree(poll);
@@ -569,7 +571,7 @@ static int __io_arm_poll_handler(struct io_kiocb *req,
569571

570572
INIT_HLIST_NODE(&req->hash_node);
571573
req->work.cancel_seq = atomic_read(&ctx->cancel_seq);
572-
io_init_poll_iocb(poll, mask, io_poll_wake);
574+
io_init_poll_iocb(poll, mask);
573575
poll->file = req->file;
574576
req->apoll_events = poll->events;
575577

0 commit comments

Comments
 (0)