Skip to content

Commit 84b7354

Browse files
keithbuschaxboe
authored andcommitted
nvme: allow integrity on extended metadata formats
The block integrity subsystem knows how to construct protection information buffers with metadata beyond the protection information fields. Remove the driver restriction. Note, this can only work if the PI field appears first in the metadata, as the integrity subsystem doesn't calculate guard tags on preceding metadata. Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Keith Busch <kbusch@kernel.org> Link: https://lore.kernel.org/r/20220303201312.3255347-3-kbusch@kernel.org Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent c340b99 commit 84b7354

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

drivers/nvme/host/core.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1616,12 +1616,9 @@ static void nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *id)
16161616
{
16171617
struct nvme_ctrl *ctrl = ns->ctrl;
16181618

1619-
/*
1620-
* The PI implementation requires the metadata size to be equal to the
1621-
* t10 pi tuple size.
1622-
*/
16231619
ns->ms = le16_to_cpu(id->lbaf[id->flbas & NVME_NS_FLBAS_LBA_MASK].ms);
1624-
if (ns->ms == sizeof(struct t10_pi_tuple))
1620+
if (id->dps & NVME_NS_DPS_PI_FIRST ||
1621+
ns->ms == sizeof(struct t10_pi_tuple))
16251622
ns->pi_type = id->dps & NVME_NS_DPS_PI_MASK;
16261623
else
16271624
ns->pi_type = 0;

0 commit comments

Comments
 (0)