From 8dcac74470ec02870477e6881766fd74a24738fe Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Wed, 11 Oct 2023 15:04:34 +0200 Subject: [PATCH] nvme: do not include meta data for PRACT=1 and MD=8 No meta data is transfered for PRACT=1 and MD=8: 5.2.2.1 Protection Information and Write Commands 5.2.2.2 Protection Informatio and Read Commands Signed-off-by: Daniel Wagner --- nvme.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/nvme.c b/nvme.c index 2549f4b18f..b9e56a48f0 100644 --- a/nvme.c +++ b/nvme.c @@ -7297,8 +7297,15 @@ static int submit_io(int opcode, char *command, const char *desc, int argc, char nvme_id_ns_flbas_to_lbaf_inuse(ns->flbas, &lba_index); ms = ns->lbaf[lba_index].ms; - if (ns->flbas & NVME_NS_FLBAS_META_EXT) - logical_block_size += ms; + if (ns->flbas & NVME_NS_FLBAS_META_EXT) { + /* + * No meta data is transfered for PRACT=1 and MD=8: + * 5.2.2.1 Protection Information and Write Commands + * 5.2.2.2 Protection Informatio and Read Commands + */ + if (!(cfg.prinfo == 0x1 && ms == 8)) + logical_block_size += ms; + } buffer_size = ((long long)cfg.block_count + 1) * logical_block_size; if (cfg.data_size < buffer_size)