]> www.infradead.org Git - users/hch/block.git/commitdiff
nvme: add vectored-io support for uring-cmd io_uring-passthrough
authorChristoph Hellwig <hch@lst.de>
Fri, 6 May 2022 06:38:00 +0000 (08:38 +0200)
committerChristoph Hellwig <hch@lst.de>
Fri, 6 May 2022 06:58:26 +0000 (08:58 +0200)
wire up support for async passthru that takes an array of buffers (using
iovec). Exposed via a new op NVME_URING_CMD_IO_VEC. Same 'struct
nvme_uring_cmd' is to be used with -

1. cmd.addr as base address of user iovec array
2. cmd.data_len as count of iovec array elements

Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20220505060616.803816-6-joshi.k@samsung.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/nvme/host/ioctl.c
include/uapi/linux/nvme_ioctl.h

index 62bd2033bce984d5c01d69e301058d95382427b9..6f03f84580175f5c72daaa22072dc0069a6813df 100644 (file)
@@ -410,7 +410,7 @@ static void nvme_uring_cmd_end_io(struct request *req, blk_status_t err)
 }
 
 static int nvme_uring_cmd_io(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
-               struct io_uring_cmd *ioucmd, unsigned int issue_flags)
+               struct io_uring_cmd *ioucmd, unsigned int issue_flags, bool vec)
 {
        struct nvme_uring_cmd_pdu *pdu = nvme_uring_cmd_pdu(ioucmd);
        const struct nvme_uring_cmd *cmd = ioucmd->cmd;
@@ -460,7 +460,7 @@ static int nvme_uring_cmd_io(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
        req = nvme_alloc_user_request(q, &c, nvme_to_user_ptr(d.addr),
                        d.data_len, nvme_to_user_ptr(d.metadata),
                        d.metadata_len, 0, &meta, d.timeout_ms ?
-                       msecs_to_jiffies(d.timeout_ms) : 0, 0, rq_flags,
+                       msecs_to_jiffies(d.timeout_ms) : 0, vec, rq_flags,
                        blk_flags);
        if (IS_ERR(req))
                return PTR_ERR(req);
@@ -583,7 +583,10 @@ static int nvme_ns_uring_cmd(struct nvme_ns *ns, struct io_uring_cmd *ioucmd,
 
        switch (ioucmd->cmd_op) {
        case NVME_URING_CMD_IO:
-               ret = nvme_uring_cmd_io(ctrl, ns, ioucmd, issue_flags);
+               ret = nvme_uring_cmd_io(ctrl, ns, ioucmd, issue_flags, false);
+               break;
+       case NVME_URING_CMD_IO_VEC:
+               ret = nvme_uring_cmd_io(ctrl, ns, ioucmd, issue_flags, true);
                break;
        default:
                ret = -ENOTTY;
index 04e458c649abab12f4002387c64c87df2ae4d2fb..0b1876aa5a594bf285b236386f893d000f4f1555 100644 (file)
@@ -107,5 +107,6 @@ struct nvme_uring_cmd {
 
 /* io_uring async commands: */
 #define NVME_URING_CMD_IO      _IOWR('N', 0x80, struct nvme_uring_cmd)
+#define NVME_URING_CMD_IO_VEC  _IOWR('N', 0x81, struct nvme_uring_cmd)
 
 #endif /* _UAPI_LINUX_NVME_IOCTL_H */