Skip to content

Commit 3a91f28

Browse files
Ming Leiaxboe
authored andcommitted
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 <[email protected]> Signed-off-by: Ming Lei <[email protected]> Reviewed-by: Caleb Sander Mateos <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 5234f2c commit 3a91f28

File tree

1 file changed

+9
-0
lines changed
  • include/linux/io_uring

1 file changed

+9
-0
lines changed

include/linux/io_uring/cmd.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,15 @@ static inline struct io_uring_cmd_data *io_uring_cmd_get_async_data(struct io_ur
140140
return cmd_to_io_kiocb(cmd)->async_data;
141141
}
142142

143+
/*
144+
* Return uring_cmd's context reference as its context handle for driver to
145+
* track per-context resource, such as registered kernel IO buffer
146+
*/
147+
static inline void *io_uring_cmd_ctx_handle(struct io_uring_cmd *cmd)
148+
{
149+
return cmd_to_io_kiocb(cmd)->ctx;
150+
}
151+
143152
int io_buffer_register_bvec(struct io_uring_cmd *cmd, struct request *rq,
144153
void (*release)(void *), unsigned int index,
145154
unsigned int issue_flags);

0 commit comments

Comments
 (0)