t/io_uring: enable support for registered buffers for passthrough
authorJens Axboe <axboe@kernel.dk>
Sat, 3 Sep 2022 17:02:10 +0000 (11:02 -0600)
committerJens Axboe <axboe@kernel.dk>
Sat, 3 Sep 2022 17:04:06 +0000 (11:04 -0600)
Signed-off-by: Jens Axboe <axboe@kernel.dk>
os/linux/io_uring.h
t/io_uring.c

index 6604e7360749909732724f934bce74009be00c3e..c7a24ad88d63dc8220076a153fe724858198ab3e 100644 (file)
@@ -46,6 +46,7 @@ struct io_uring_sqe {
                __u32           rename_flags;
                __u32           unlink_flags;
                __u32           hardlink_flags;
+               __u32           uring_cmd_flags;
        };
        __u64   user_data;      /* data to be passed back at completion time */
        /* pack this to avoid bogus arm OABI complaints */
@@ -197,6 +198,13 @@ enum {
        IORING_OP_LAST,
 };
 
+/*
+ * sqe->uring_cmd_flags
+ * IORING_URING_CMD_FIXED      use registered buffer; pass thig flag
+ *                             along with setting sqe->buf_index.
+ */
+#define IORING_URING_CMD_FIXED (1U << 0)
+
 /*
  * sqe->fsync_flags
  */
index 3bce9e7e983a48ccaa35b088f39e2ade48d06290..b9353ac867331a2162a697876b7a37cfe408b0b1 100644 (file)
@@ -650,6 +650,10 @@ static void init_io_pt(struct submitter *s, unsigned index)
        cmd->cdw12 = nlb;
        cmd->addr = (unsigned long) s->iovecs[index].iov_base;
        cmd->data_len = bs;
+       if (fixedbufs) {
+               sqe->uring_cmd_flags = IORING_URING_CMD_FIXED;
+               sqe->buf_index = index;
+       }
        cmd->nsid = f->nsid;
        cmd->opcode = 2;
 }