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: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I3351e3e3b7816f726752e85604cf557251d9870c
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468018
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-09-11 14:31:12 +09:00 committed by Ben Walker
parent 062a5503ae
commit 8253ed5e31

View File

@ -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;
}