diff options
author | Ming Lei <ming.lei@redhat.com> | 2025-05-22 18:20:39 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2025-05-22 19:03:55 +0300 |
commit | 3a91f28fab43f093c72312148288d125ae160c2d (patch) | |
tree | 8f24f71c093a4863f4af277ccb36acce801d4d1e | |
parent | 5234f2c3e3010f1b9c90b617e92c4b38e3240914 (diff) | |
download | linux-3a91f28fab43f093c72312148288d125ae160c2d.tar.xz |
io_uring: add helper io_uring_cmd_ctx_handle()
Add helper io_uring_cmd_ctx_handle() for driver to track per-context
resource, such as registered kernel io buffer.
Suggested-by: Caleb Sander Mateos <csander@purestorage.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Caleb Sander Mateos <csander@purestorage.com>
Link: https://lore.kernel.org/r/20250522152043.399824-2-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | include/linux/io_uring/cmd.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/io_uring/cmd.h b/include/linux/io_uring/cmd.h index 0634a3de1782..53408124c1e5 100644 --- a/include/linux/io_uring/cmd.h +++ b/include/linux/io_uring/cmd.h @@ -140,6 +140,15 @@ static inline struct io_uring_cmd_data *io_uring_cmd_get_async_data(struct io_ur return cmd_to_io_kiocb(cmd)->async_data; } +/* + * Return uring_cmd's context reference as its context handle for driver to + * track per-context resource, such as registered kernel IO buffer + */ +static inline void *io_uring_cmd_ctx_handle(struct io_uring_cmd *cmd) +{ + return cmd_to_io_kiocb(cmd)->ctx; +} + int io_buffer_register_bvec(struct io_uring_cmd *cmd, struct request *rq, void (*release)(void *), unsigned int index, unsigned int issue_flags); |