Skip to contentSkip to conversation

Set extended metadata field properly

PATCH New Igor Konopko 2 participants 3 messages May 29, 2018 NVMe

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Set extended metadata field properly

When setting extended metadata indicator in namespace structure we take metadata size into consideration. Unfortunately up-to-date metadata size is
not yet set during this calculation, which results in incorrect setting of that field in some cases.

This patch fixes that issue.

Signed-off-by Igor Konopko <igor.j.konopko at intel.com>
---
 drivers/nvme/host/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/core.c +1 -1
index 5e1d6d69b307..553af7531329 100644
@@ -1448,8 +1448,8 @@ static void __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id)
 	if (ns->lba_shift == 0)
 		ns->lba_shift = 9;
 	ns->noiob = le16_to_cpu(id->noiob);
-	ns->ext = ns->ms && (id->flbas & NVME_NS_FLBAS_META_EXT);
 	ns->ms = le16_to_cpu(id->lbaf[id->flbas & NVME_NS_FLBAS_LBA_MASK].ms);
+	ns->ext = ns->ms && (id->flbas & NVME_NS_FLBAS_META_EXT);
 	/* the PI implementation requires metadata equal t10 pi tuple size */
 	if (ns->ms == sizeof(struct t10_pi_tuple))
 		ns->pi_type = id->dps & NVME_NS_DPS_PI_MASK;
Signature · 1 line
2.14.3
#1 lore raw

PATCH 1/1 Set extended metadata field properly

Hi Igor,
I've sent the same patch in my T10-PI support addition to NVMe/RDMA. Christoph already reviewed and said he'll merge it to nvme branch.

Quoted 28 lines · Igor Konopko

When setting extended metadata indicator in namespace structure we take metadata size into consideration. Unfortunately up-to-date metadata size is
not yet set during this calculation, which results in incorrect setting of that field in some cases.

This patch fixes that issue.

Signed-off-by Igor Konopko <igor.j.konopko at intel.com>
---
  drivers/nvme/host/core.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/core.c +1 -1
index 5e1d6d69b307..553af7531329 100644
@@ -1448,8 +1448,8 @@ static void __nvme_revalidate_disk(struct gendisk *disk, struct nvme_id_ns *id)
  	if (ns->lba_shift == 0)
  		ns->lba_shift = 9;
  	ns->noiob = le16_to_cpu(id->noiob);
-	ns->ext = ns->ms && (id->flbas & NVME_NS_FLBAS_META_EXT);
  	ns->ms = le16_to_cpu(id->lbaf[id->flbas & NVME_NS_FLBAS_LBA_MASK].ms);
+	ns->ext = ns->ms && (id->flbas & NVME_NS_FLBAS_META_EXT);
  	/* the PI implementation requires metadata equal t10 pi tuple size */
  	if (ns->ms == sizeof(struct t10_pi_tuple))
  		ns->pi_type = id->dps & NVME_NS_DPS_PI_MASK;
#2 lore raw

PATCH 1/1 Set extended metadata field properly

Got it, thanks
Igor

Quoted 40 lines

-----Original Message-----
From: Max Gurtovoy [mailto:maxg at mellanox.com]
Sent: Tuesday, May 29, 2018 3:50 PM
To: Konopko, Igor J <igor.j.konopko at intel.com>; linux-nvme at lists.infradead.org
Subject: Re: [PATCH] Set extended metadata field properly

Hi Igor,
I've sent the same patch in my T10-PI support addition to NVMe/RDMA. Christoph already reviewed and said he'll merge it to nvme branch.

drivers/nvme/host/core.c static void __nvme_revalidate_disk(struct gendisk *disk, struct

Quoted 18 lines · Igor Konopko

When setting extended metadata indicator in namespace structure we take metadata size into consideration. Unfortunately up-to-date metadata size is
not yet set during this calculation, which results in incorrect setting of that field in some cases.

This patch fixes that issue.

Signed-off-by Igor Konopko <igor.j.konopko at intel.com>
---
  drivers/nvme/host/core.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/nvme/host/core.c +0 -0
index 5e1d6d69b307..553af7531329 100644
@@ -1448,8 +1448,8 @@ static void __nvme_revalidate_disk(struct gendisk *disk, struct

nvme_id_ns *id)

Quoted 10 lines
drivers/nvme/host/core.c +1 -1
  	if (ns->lba_shift == 0)
  		ns->lba_shift = 9;
  	ns->noiob = le16_to_cpu(id->noiob);
-	ns->ext = ns->ms && (id->flbas & NVME_NS_FLBAS_META_EXT);
  	ns->ms = le16_to_cpu(id->lbaf[id->flbas & NVME_NS_FLBAS_LBA_MASK].ms);
+	ns->ext = ns->ms && (id->flbas & NVME_NS_FLBAS_META_EXT);
  	/* the PI implementation requires metadata equal t10 pi tuple size */
  	if (ns->ms == sizeof(struct t10_pi_tuple))
  		ns->pi_type = id->dps & NVME_NS_DPS_PI_MASK;