diff options
author | Ming Lei <ming.lei@redhat.com> | 2023-09-28 15:43:25 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2023-09-28 16:36:00 +0300 |
commit | 93b8cc60c37b9d17732b7a297e5dca29b50a990d (patch) | |
tree | 69dc83ff4f33883707fc33fc30ad70cc40638969 /include/linux/io_uring_types.h | |
parent | 528ce6781726e022bc5dc84034360e6e8f1b89bd (diff) | |
download | linux-93b8cc60c37b9d17732b7a297e5dca29b50a990d.tar.xz |
io_uring: cancelable uring_cmd
uring_cmd may never complete, such as ublk, in which uring cmd isn't
completed until one new block request is coming from ublk block device.
Add cancelable uring_cmd to provide mechanism to driver for cancelling
pending commands in its own way.
Add API of io_uring_cmd_mark_cancelable() for driver to mark one command as
cancelable, then io_uring will cancel this command in
io_uring_cancel_generic(). ->uring_cmd() callback is reused for canceling
command in driver's way, then driver gets notified with the cancelling
from io_uring.
Add API of io_uring_cmd_get_task() to help driver cancel handler
deal with the canceling.
Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de>
Suggested-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'include/linux/io_uring_types.h')
-rw-r--r-- | include/linux/io_uring_types.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/io_uring_types.h b/include/linux/io_uring_types.h index fe1c5d4ec56c..e178461fa513 100644 --- a/include/linux/io_uring_types.h +++ b/include/linux/io_uring_types.h @@ -265,6 +265,12 @@ struct io_ring_ctx { */ struct io_wq_work_list iopoll_list; bool poll_multi_queue; + + /* + * Any cancelable uring_cmd is added to this list in + * ->uring_cmd() by io_uring_cmd_insert_cancelable() + */ + struct hlist_head cancelable_uring_cmd; } ____cacheline_aligned_in_smp; struct { |