From: Hao Xu <howeyxu@xxxxxxxxxxx> Add a new member hash_index in struct io_kiocb to track the req index in cancel_hash array. This is needed in later patches. Signed-off-by: Hao Xu <howeyxu@xxxxxxxxxxx> --- io_uring/io_uring_types.h | 1 + io_uring/poll.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/io_uring/io_uring_types.h b/io_uring/io_uring_types.h index 7c22cf35a7e2..2041ee83467d 100644 --- a/io_uring/io_uring_types.h +++ b/io_uring/io_uring_types.h @@ -474,6 +474,7 @@ struct io_kiocb { u64 extra2; }; }; + unsigned int hash_index; /* internal polling, see IORING_FEAT_FAST_POLL */ struct async_poll *apoll; /* opcode allocated if it needs to store data for async defer */ diff --git a/io_uring/poll.c b/io_uring/poll.c index 0df5eca93b16..95e28f32b49c 100644 --- a/io_uring/poll.c +++ b/io_uring/poll.c @@ -74,8 +74,10 @@ static void io_poll_req_insert(struct io_kiocb *req) { struct io_ring_ctx *ctx = req->ctx; struct hlist_head *list; + u32 index = hash_long(req->cqe.user_data, ctx->cancel_hash_bits); - list = &ctx->cancel_hash[hash_long(req->cqe.user_data, ctx->cancel_hash_bits)]; + req->hash_index = index; + list = &ctx->cancel_hash[index]; hlist_add_head(&req->hash_node, list); } -- 2.25.1