[PATCH v5] nvme: rename nvme_ns_has_pi() to nvme_ns_supports_pract()
Tokunori Ikegami
ikegami.t at gmail.com
Wed Oct 23 09:56:51 PDT 2024
It checks if supports metadata actions by the controller (generate/strip).
So change the function name as so correctly.
Note: It is only supported when the metadata size and PI size are same.
Signed-off-by: Tokunori Ikegami <ikegami.t at gmail.com>
---
Changes since v4 to v5:
- Delete to change the ms >= PI check so just only the function name changed.
Changes since v3 to v4:
- Change the function name nvme_ns_has_pi() to nvme_ns_supports_pract().
Changes since v2 to v3:
- Delete the nvme_submit_io() changes as only change the nvme_ns_has_pi().
Changes since v1:
- Fix the commit message spelling miss hte to the.
drivers/nvme/host/core.c | 12 +++++++-----
drivers/nvme/host/nvme.h | 2 +-
drivers/nvme/host/rdma.c | 2 +-
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 84cb859a911d..5a7f7ce2bc49 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -915,7 +915,7 @@ static inline blk_status_t nvme_setup_write_zeroes(struct nvme_ns *ns,
(ns->head->features & NVME_NS_DEAC))
cmnd->write_zeroes.control |= cpu_to_le16(NVME_WZ_DEAC);
- if (nvme_ns_has_pi(ns->head)) {
+ if (nvme_ns_supports_pract(ns->head)) {
cmnd->write_zeroes.control |= cpu_to_le16(NVME_RW_PRINFO_PRACT);
switch (ns->head->pi_type) {
@@ -999,7 +999,7 @@ static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns,
* namespace capacity to zero to prevent any I/O.
*/
if (!blk_integrity_rq(req)) {
- if (WARN_ON_ONCE(!nvme_ns_has_pi(ns->head)))
+ if (WARN_ON_ONCE(!nvme_ns_supports_pract(ns->head)))
return BLK_STS_NOTSUPP;
control |= NVME_RW_PRINFO_PRACT;
}
@@ -1766,7 +1766,7 @@ static bool nvme_init_integrity(struct nvme_ns_head *head,
*/
if (!IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY) ||
!(head->features & NVME_NS_METADATA_SUPPORTED))
- return nvme_ns_has_pi(head);
+ return nvme_ns_supports_pract(head);
switch (head->pi_type) {
case NVME_NS_DPS_PI_TYPE3:
@@ -1929,14 +1929,16 @@ static void nvme_configure_metadata(struct nvme_ctrl *ctrl,
/*
* The current fabrics transport drivers support namespace
- * metadata formats only if nvme_ns_has_pi() returns true.
+ * metadata formats only if nvme_ns_supports_pract() returns
+ * true.
* Suppress support for all other formats so the namespace will
* have a 0 capacity and not be usable through the block stack.
*
* Note, this check will need to be modified if any drivers
* gain the ability to use other metadata formats.
*/
- if (ctrl->max_integrity_segments && nvme_ns_has_pi(head))
+ if (ctrl->max_integrity_segments &&
+ nvme_ns_supports_pract(head))
head->features |= NVME_NS_METADATA_SUPPORTED;
} else {
/*
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index 093cb423f536..7f31e085f6a0 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -540,7 +540,7 @@ struct nvme_ns {
};
/* NVMe ns supports metadata actions by the controller (generate/strip) */
-static inline bool nvme_ns_has_pi(struct nvme_ns_head *head)
+static inline bool nvme_ns_supports_pract(struct nvme_ns_head *head)
{
return head->pi_type && head->ms == head->pi_size;
}
diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index 24a2759798d0..e09fee1dd15c 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -2037,7 +2037,7 @@ static blk_status_t nvme_rdma_queue_rq(struct blk_mq_hw_ctx *hctx,
queue->pi_support &&
(c->common.opcode == nvme_cmd_write ||
c->common.opcode == nvme_cmd_read) &&
- nvme_ns_has_pi(ns->head))
+ nvme_ns_supports_pract(ns->head))
req->use_sig_mr = true;
else
req->use_sig_mr = false;
--
2.45.2
More information about the Linux-nvme
mailing list