Skip to content

Commit a6ccb48

Browse files
isilenceaxboe
authored andcommitted
io_uring/cmd: give inline space in request to cmds
Some io_uring commands can use some inline space in io_kiocb. We have 32 bytes in struct io_uring_cmd, expose it. Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/7ca779a61ee5e166e535d70df9c7f07b15d8a0ce.1726072086.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
1 parent 6746ee4 commit a6ccb48

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
@@ -23,6 +23,15 @@ static inline const void *io_uring_sqe_cmd(const struct io_uring_sqe *sqe)
2323
return sqe->cmd;
2424
}
2525

26+
static inline void io_uring_cmd_private_sz_check(size_t cmd_sz)
27+
{
28+
BUILD_BUG_ON(cmd_sz > sizeof_field(struct io_uring_cmd, pdu));
29+
}
30+
#define io_uring_cmd_to_pdu(cmd, pdu_type) ( \
31+
io_uring_cmd_private_sz_check(sizeof(pdu_type)), \
32+
((pdu_type *)&(cmd)->pdu) \
33+
)
34+
2635
#if defined(CONFIG_IO_URING)
2736
int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw,
2837
struct iov_iter *iter, void *ioucmd);

0 commit comments

Comments
 (0)