summaryrefslogtreecommitdiffstats
path: root/io_uring/io_uring.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2022-05-24 16:32:05 +0200
committerJens Axboe <axboe@kernel.dk>2022-07-25 02:39:10 +0200
commitf49eca21563b6d919d49828aaed9eab5d8090361 (patch)
treec1c9103fe9689aae1aacb49ec74d2164d73ee346 /io_uring/io_uring.c
parentio_uring: move req async preparation into opcode handler (diff)
downloadlinux-f49eca21563b6d919d49828aaed9eab5d8090361.tar.xz
linux-f49eca21563b6d919d49828aaed9eab5d8090361.zip
io_uring: add generic command payload type to struct io_kiocb
Each opcode generally has a command structure in io_kiocb which it can use to store data associated with that request. In preparation for having the core layer not know about what's inside these fields, add a generic io_cmd_data type and put in the union as well. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to '')
-rw-r--r--io_uring/io_uring.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index f353822436c4..c596ffd92a0a 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -954,14 +954,27 @@ enum {
};
/*
- * NOTE! Each of the iocb union members has the file pointer
- * as the first entry in their struct definition. So you can
- * access the file pointer through any of the sub-structs,
- * or directly as just 'file' in this struct.
+ * Each request type overlays its private data structure on top of this one.
+ * They must not exceed this one in size.
*/
+struct io_cmd_data {
+ struct file *file;
+ /* each command gets 56 bytes of data */
+ __u8 data[56];
+};
+
+#define io_kiocb_to_cmd(req) ((void *) &(req)->cmd)
+
struct io_kiocb {
union {
+ /*
+ * NOTE! Each of the io_kiocb union members has the file pointer
+ * as the first entry in their struct definition. So you can
+ * access the file pointer through any of the sub-structs,
+ * or directly as just 'file' in this struct.
+ */
struct file *file;
+ struct io_cmd_data cmd;
struct io_rw rw;
struct io_poll_iocb poll;
struct io_poll_update poll_update;