Skip to contentSkip to conversation

nvme: don't hard code size of struct t10_pi_tuple

PATCH Superseded Sagi Grimberg 2 participants 3 messages Jun 15, 2017 – Jun 16, 2017 NVMe

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Sagi Grimberg

author maintainer
#0 lore raw

PATCH 1/1 nvme: don't hard code size of struct t10_pi_tuple

Signed-off-by Sagi Grimberg <sagi at grimberg.me>
---
 drivers/nvme/host/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/host/core.c +2 -1
index a5b7926cf7f6..761ca3e6ee2e 100644
@@ -336,7 +336,8 @@ static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns,
 	 * unless this namespace is formated such that the metadata can be
 	 * stripped/generated by the controller with PRACT=1.
 	 */
-	if (ns && ns->ms && (!ns->pi_type || ns->ms != 8) &&
+	if (ns && ns->ms &&
+	    (!ns->pi_type) || ns->ms != sizeof(struct t10_pi_tuple)) &&
 	    !blk_integrity_rq(req) && !blk_rq_is_passthrough(req))
 		return BLK_STS_NOTSUPP;
 
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 nvme: don't hard code size of struct t10_pi_tuple

Quoted 10 lines · Sagi Grimberg
Signed-off-by Sagi Grimberg <sagi at grimberg.me>
---
 drivers/nvme/host/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvme/host/core.c +0 -0
index a5b7926cf7f6..761ca3e6ee2e 100644

drivers/nvme/host/core.c static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns, · line 340

Quoted 6 lines
drivers/nvme/host/core.c +2 -1
@@ -336,7 +336,8 @@ static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns,
 	 * unless this namespace is formated such that the metadata can be
 	 * stripped/generated by the controller with PRACT=1.
 	 */
-	if (ns && ns->ms && (!ns->pi_type || ns->ms != 8) &&
+	if (ns && ns->ms &&
+	    (!ns->pi_type) || ns->ms != sizeof(struct t10_pi_tuple)) &&

This actually got the braces wrong, I'll fix it up.

#2 lore raw

PATCH 1/1 nvme: don't hard code size of struct t10_pi_tuple

Quoted 6 lines · Christoph Hellwig
Quoted 5 lines · Sagi Grimberg
Signed-off-by Sagi Grimberg <sagi at grimberg.me>
---
 drivers/nvme/host/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 13 lines

drivers/nvme/host/core.c static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns, · line 340

Quoted 11 lines
drivers/nvme/host/core.c +2 -1
index a5b7926cf7f6..761ca3e6ee2e 100644
@@ -336,7 +336,8 @@ static inline blk_status_t nvme_setup_rw(struct nvme_ns *ns,
 	 * unless this namespace is formated such that the metadata can be
 	 * stripped/generated by the controller with PRACT=1.
 	 */
-	if (ns && ns->ms && (!ns->pi_type || ns->ms != 8) &&
+	if (ns && ns->ms &&
+	    (!ns->pi_type) || ns->ms != sizeof(struct t10_pi_tuple)) &&

This actually got the braces wrong, I'll fix it up.

Actually I only applied your already fixed up V2. -ENOCOFFEE