Skip to content

Commit

Permalink
fs:aio: Remove TODO comment suggesting hash or array usage in io_canc…
Browse files Browse the repository at this point in the history
…el()

The comment suggests a hash or array approach to
store the active requests. Currently it iterates
through all the active requests and when found
deletes the requested request, in the linked list.
However io_cancel() isn’t a frequently used operation,
and optimizing it wouldn’t bring a substantial benefit
to real users and the increased complexity of maintaining
a hashtable for this would be significant and will slow
down other operation. Therefore remove this TODO
to avoid people spending time improving this.

Signed-off-by: Mohammed Anees <pvmohammedanees2003@gmail.com>
Link: https://lore.kernel.org/r/20241112113906.15825-1-pvmohammedanees2003@gmail.com
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>
  • Loading branch information
Mohammed Anees authored and Christian Brauner committed Nov 12, 2024
1 parent 1c82587 commit c4d7d90
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion fs/aio.c
Original file line number Diff line number Diff line change
Expand Up @@ -2191,7 +2191,6 @@ SYSCALL_DEFINE3(io_cancel, aio_context_t, ctx_id, struct iocb __user *, iocb,
return -EINVAL;

spin_lock_irq(&ctx->ctx_lock);
/* TODO: use a hash or array, this sucks. */
list_for_each_entry(kiocb, &ctx->active_reqs, ki_list) {
if (kiocb->ki_res.obj == obj) {
ret = kiocb->ki_cancel(&kiocb->rw);
Expand Down

0 comments on commit c4d7d90

Please sign in to comment.