Commit 8253ed5e authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Ben Walker
Browse files

nvme/perf: Fix the wrong block size when metadata size is 8 bytes and PRACT is set



When PRACT is set, if metadata size is 8 bytes, PI is stripped
(read) or inserted (write). Hence block size must not include
metadata size for extended LBA payload. This patch fixes the issue
by reducing metadata size from block size for this case.

On the other hand, When PRACT is set, if metadata size is larger
than 8 bytes, PI is passed (read) or replaced (write). So block
size is not necessary to change for this case.

The wrong block size didn't cause any visible issue but should be fixed.

Signed-off-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I3351e3e3b7816f726752e85604cf557251d9870c
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468018


Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 062a5503
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -728,6 +728,15 @@ register_ns(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ns *ns)
		entry->io_flags = g_metacfg_pract_flag | g_metacfg_prchk_flags;
	}

	/* If metadata size = 8 bytes, PI is stripped (read) or inserted (write),
	 *  and so reduce metadata size from block size.  (If metadata size > 8 bytes,
	 *  PI is passed (read) or replaced (write).  So block size is not necessary
	 *  to change.)
	 */
	if ((entry->io_flags & SPDK_NVME_IO_FLAGS_PRACT) && (entry->md_size == 8)) {
		entry->block_size = spdk_nvme_ns_get_sector_size(ns);
	}

	if (g_max_io_md_size < entry->md_size) {
		g_max_io_md_size = entry->md_size;
	}