nvme/ioctl: improve user request allocation
cover nvme/ioctl: improve user request allocation
Previously nvme command copied for the user request allocation. But the nvme command already allocated for the request.
So change to just set the nvme command values directly without the copy. Also fixed the checkpatch.pl warnings for the unsigned values.
Tokunori Ikegami (2):
nvme/ioctl: split user request allocation from user command submission nvme/ioctl: fix unsigned value as unsigned int value
drivers/nvme/host/core.c | 10 +- drivers/nvme/host/ioctl.c | 230 +++++++++++++++++++++----------------- 2 files changed, 134 insertions(+), 106 deletions(-)
Signature · 1 line
2.48.1
PATCH 1/2 nvme/ioctl: split user request allocation from user command submission
Delete unnecessary nvme command copy for the performance improvement.
Signed-off-by Tokunori Ikegami <[email protected]>
--- drivers/nvme/host/core.c | 10 +- drivers/nvme/host/ioctl.c | 213 +++++++++++++++++++++----------------- 2 files changed, 125 insertions(+), 98 deletions(-)
drivers/nvme/host/core.c +6 -4
@@ -734,14 +734,16 @@ void nvme_init_request(struct request *req, struct nvme_command *cmd)if (!logging_enabled) req->rq_flags |=RQF_QUIET ; -/* passthru commands should let the driver set the SGL flags */ - cmd->common.flags &= ~NVME_CMD_SGL_ALL ; - req->cmd_flags |=REQ_FAILFAST_DRIVER ;if (req->mq_hctx->type ==HCTX_TYPE_POLL ) req->cmd_flags |=REQ_POLLED ;nvme_clear_nvme_request (req); -memcpy (nr->cmd, cmd,sizeof (*cmd)); + +if (likely (cmd)) { +/* passthru commands should let the driver set the SGL flags */ + cmd->common.flags &= ~NVME_CMD_SGL_ALL ; +memcpy (nr->cmd, cmd,sizeof (*cmd)); + } }EXPORT_SYMBOL_GPL (nvme_init_request);
drivers/nvme/host/ioctl.c +119 -94
357 lines not on this page · raw message
Signature · 1 line
2.48.1
PATCH 2/2 nvme/ioctl: fix unsigned value as unsigned int value
In reply to Tokunori IkegamiThis is to fix for the checkpatch.pl warning.
Signed-off-by Tokunori Ikegami <[email protected]>
--- drivers/nvme/host/ioctl.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/nvme/host/ioctl.c +10 -9
@@ -112,8 +112,9 @@ static struct request *nvme_alloc_user_request(struct request_queue *q, }static int nvme_map_user_request (struct request *req,u64 ubuffer, -unsigned bufflen,void __user *meta_buffer,unsigned meta_len, -struct iov_iter *iter,unsigned int flags) +unsigned int bufflen,void __user *meta_buffer, +unsigned int meta_len,struct iov_iter *iter, +unsigned int flags) {struct request_queue *q = req->q;struct nvme_ns *ns = q->queuedata;
@@ -164,9 +165,9 @@ static int nvme_map_user_request(struct request *req, u64 ubuffer, }static int nvme_submit_user_cmd (struct request_queue *q, -struct request *req,u64 ubuffer,unsigned bufflen, -void __user *meta_buffer,unsigned meta_len, -u64 *result,unsigned timeout,unsigned int flags) +struct request *req,u64 ubuffer,unsigned int bufflen, +void __user *meta_buffer,unsigned int meta_len, +u64 *result,unsigned int timeout,unsigned int flags) {struct nvme_command *cmd =nvme_req (req)->cmd;struct nvme_ns *ns = q->queuedata;
@@ -207,7 +208,7 @@ static int nvme_submit_io(struct nvme_ns *ns, struct nvme_user_io __user *uio) {struct nvme_user_io io;struct nvme_command *c; -unsigned length, meta_len; +unsigned int length, meta_len;void __user *metadata;struct request *req;
@@ -292,7 +293,7 @@ static int nvme_user_cmd(struct nvme_ctrl *ctrl, struct nvme_ns *ns,struct request_queue *q = ns ? ns->queue : ctrl->admin_q;struct nvme_passthru_cmd cmd;struct nvme_command *c; -unsigned timeout =0 ; +unsigned int timeout =0 ;struct request *req;u64 result;int status;
@@ -349,7 +350,7 @@ static int nvme_user_cmd64(struct nvme_ctrl *ctrl, struct nvme_ns *ns,struct request_queue *q = ns ? ns->queue : ctrl->admin_q;struct nvme_passthru_cmd64 cmd;struct nvme_command *c; -unsigned timeout =0 ; +unsigned int timeout =0 ;struct request *req;int status;
@@ -423,7 +424,7 @@ static inline struct nvme_uring_cmd_pdu *nvme_uring_cmd_pdu( }static void nvme_uring_task_cb (struct io_uring_cmd *ioucmd, -unsigned issue_flags) +unsigned int issue_flags) {struct nvme_uring_cmd_pdu *pdu =nvme_uring_cmd_pdu (ioucmd);
Signature · 1 line
2.48.1