[PATCH 3/6] nvme-ioctl: fold 'vec' into flags

Keith Busch kbusch at meta.com
Mon Feb 24 10:21:25 PST 2025


From: Keith Busch <kbusch at kernel.org>

The vec indicator is already a flag and used as such, so use that type
instead of implicitly relying on a bool to happen to align to the enum
value.

Signed-off-by: Keith Busch <kbusch at kernel.org>
---
 drivers/nvme/host/ioctl.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c
index f1233a280d3b3..3da014ccbe550 100644
--- a/drivers/nvme/host/ioctl.c
+++ b/drivers/nvme/host/ioctl.c
@@ -455,7 +455,8 @@ static enum rq_end_io_ret nvme_uring_cmd_end_io(struct request *req,
 }
 
 static int nvme_uring_cmd_io(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
-		struct io_uring_cmd *ioucmd, unsigned int issue_flags, bool vec)
+		struct io_uring_cmd *ioucmd, unsigned int issue_flags,
+		unsigned int flags)
 {
 	struct nvme_uring_cmd_pdu *pdu = nvme_uring_cmd_pdu(ioucmd);
 	const struct nvme_uring_cmd *cmd = io_uring_sqe_cmd(ioucmd->sqe);
@@ -465,7 +466,6 @@ static int nvme_uring_cmd_io(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
 	struct request *req;
 	blk_opf_t rq_flags = REQ_ALLOC_CACHE;
 	blk_mq_req_flags_t blk_flags = 0;
-	unsigned int flags = 0;
 	int ret;
 
 	c.common.opcode = READ_ONCE(cmd->opcode);
@@ -514,7 +514,7 @@ static int nvme_uring_cmd_io(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
 
 	if (d.addr && d.data_len) {
 		ret = nvme_map_user_request(req, d.addr, d.data_len, d.metadata,
-					    d.metadata_len, ioucmd, vec);
+					    d.metadata_len, ioucmd, flags);
 		if (ret)
 			return ret;
 	}
@@ -651,10 +651,11 @@ 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, false);
+		ret = nvme_uring_cmd_io(ctrl, ns, ioucmd, issue_flags, 0);
 		break;
 	case NVME_URING_CMD_IO_VEC:
-		ret = nvme_uring_cmd_io(ctrl, ns, ioucmd, issue_flags, true);
+		ret = nvme_uring_cmd_io(ctrl, ns, ioucmd, issue_flags,
+					NVME_IOCTL_VEC);
 		break;
 	default:
 		ret = -ENOTTY;
@@ -793,10 +794,11 @@ int nvme_dev_uring_cmd(struct io_uring_cmd *ioucmd, unsigned int issue_flags)
 
 	switch (ioucmd->cmd_op) {
 	case NVME_URING_CMD_ADMIN:
-		ret = nvme_uring_cmd_io(ctrl, NULL, ioucmd, issue_flags, false);
+		ret = nvme_uring_cmd_io(ctrl, NULL, ioucmd, issue_flags, 0);
 		break;
 	case NVME_URING_CMD_ADMIN_VEC:
-		ret = nvme_uring_cmd_io(ctrl, NULL, ioucmd, issue_flags, true);
+		ret = nvme_uring_cmd_io(ctrl, NULL, ioucmd, issue_flags,
+					NVME_IOCTL_VEC);
 		break;
 	default:
 		ret = -ENOTTY;
-- 
2.43.5




More information about the Linux-nvme mailing list