diff options
author | Jens Axboe <axboe@kernel.dk> | 2024-09-30 14:30:39 -0600 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-10-29 13:43:27 -0600 |
commit | 8abf47a8d61c9e8314ae4cfa27e18c8df67c37bc (patch) | |
tree | 988ed6a3b1286331822fe2b5ab5c4ec4fcbe05f4 | |
parent | ba4366f57b117c2eab996642288e5c75646ccfc9 (diff) |
io_uring/cancel: get rid of init_hash_table() helper
All it does is initialize the lists, just move the INIT_HLIST_HEAD()
into the one caller.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | io_uring/cancel.c | 8 | ||||
-rw-r--r-- | io_uring/cancel.h | 1 | ||||
-rw-r--r-- | io_uring/io_uring.c | 4 |
3 files changed, 3 insertions, 10 deletions
diff --git a/io_uring/cancel.c b/io_uring/cancel.c index 755dd5506a5f..cc3475b22ae5 100644 --- a/io_uring/cancel.c +++ b/io_uring/cancel.c @@ -232,14 +232,6 @@ done: return IOU_OK; } -void init_hash_table(struct io_hash_table *table, unsigned size) -{ - unsigned int i; - - for (i = 0; i < size; i++) - INIT_HLIST_HEAD(&table->hbs[i].list); -} - static int __io_sync_cancel(struct io_uring_task *tctx, struct io_cancel_data *cd, int fd) { diff --git a/io_uring/cancel.h b/io_uring/cancel.h index b33995e00ba9..bbfea2cd00ea 100644 --- a/io_uring/cancel.h +++ b/io_uring/cancel.h @@ -20,7 +20,6 @@ int io_async_cancel(struct io_kiocb *req, unsigned int issue_flags); int io_try_cancel(struct io_uring_task *tctx, struct io_cancel_data *cd, unsigned int issue_flags); -void init_hash_table(struct io_hash_table *table, unsigned size); int io_sync_cancel(struct io_ring_ctx *ctx, void __user *arg); bool io_cancel_req_match(struct io_kiocb *req, struct io_cancel_data *cd); diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index f4e069cd03a5..6aac72b2958f 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -263,13 +263,15 @@ static int io_alloc_hash_table(struct io_hash_table *table, unsigned bits) { unsigned hash_buckets = 1U << bits; size_t hash_size = hash_buckets * sizeof(table->hbs[0]); + int i; table->hbs = kmalloc(hash_size, GFP_KERNEL); if (!table->hbs) return -ENOMEM; table->hash_bits = bits; - init_hash_table(table, hash_buckets); + for (i = 0; i < hash_buckets; i++) + INIT_HLIST_HEAD(&table->hbs[i].list); return 0; } |