]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme: do not include meta data for PRACT=1 and MD=8
authorDaniel Wagner <dwagner@suse.de>
Wed, 11 Oct 2023 13:04:34 +0000 (15:04 +0200)
committerKeith Busch <kbusch@kernel.org>
Wed, 11 Oct 2023 14:13:39 +0000 (08:13 -0600)
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 <dwagner@suse.de>
nvme.c

diff --git a/nvme.c b/nvme.c
index 2549f4b18f6cecac9443288b0032380e1366335c..b9e56a48f0a59e4496ca26362bde501f59b00c71 100644 (file)
--- 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)