Commit 31a1b193 authored by Alexey Marchuk's avatar Alexey Marchuk Committed by Tomasz Zawadzki
Browse files

perf: Add check that io_size is a multiple of ns sector size



It is possible to specify io_size which is not a multiple
of sector size and in that case real IO will have size
of g_io_size_bytes/sector_size. It is integer division, so
IO will be less than requested by the user. At the same
time performance statistics are reported using io_size
specified by the user (which is bigger than real IO size)
so we have wrong statistics (e.g. we can see BW higher
than NIC line rate).
To avoid this confusing situation, add a check that
user's io_size can be evenly divided by ns sector size.

Signed-off-by: default avatarAlexey Marchuk <alexeymar@mellanox.com>
Change-Id: Ie63b5b7b3d99b5c51c10ec09e084fd30d6cb33dd
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9733


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent 089cbda8
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1207,6 +1207,13 @@ register_ns(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ns *ns)
		return;
	}

	if (g_io_size_bytes % sector_size != 0) {
		printf("WARNING: IO size %u (-o) is not a multiple of nsid %u sector size %u."
		       " Removing this ns from test\n", g_io_size_bytes, spdk_nvme_ns_get_id(ns), sector_size);
		g_warn = true;
		return;
	}

	max_xfer_size = spdk_nvme_ns_get_max_io_xfer_size(ns);
	spdk_nvme_ctrlr_get_default_io_qpair_opts(ctrlr, &opts, sizeof(opts));
	/* NVMe driver may add additional entries based on