Commit edb6e5b4 authored by Changpeng Liu's avatar Changpeng Liu Committed by Jim Harris
Browse files

nvme/perf: fix the wrong caculation of queue pair requests



For the commands sent from upper layer, the NVMe driver may
split one command into several children requests based on
stripe and data length, so number of requests in each queue
pair has a value which is start from 512.  we must ensure
that the number of request in each queue pair is big enough
to process all the commands, e.g: a user's input for a 512KiB
read can be divided into 5 children NVMe commands when maximum
transfer length is 128KiB, in addition, one parent request is
occupied to track children commands.

Fix issues #566 and #573.

Change-Id: I162da8e1e15692625ce311e68a72c89b6492dd56
Signed-off-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/440457


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
parent aff99b6f
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -581,6 +581,10 @@ register_ns(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ns *ns)
		       "IO requests may be queued at the NVMe driver.\n");
		g_warn = true;
	}
	/* For requests which have children requests, parent request itself
	 * will also occupy 1 entry.
	 */
	entries += 1;

	entry = calloc(1, sizeof(struct ns_entry));
	if (entry == NULL) {
@@ -592,7 +596,7 @@ register_ns(struct spdk_nvme_ctrlr *ctrlr, struct spdk_nvme_ns *ns)
	entry->fn_table = &nvme_fn_table;
	entry->u.nvme.ctrlr = ctrlr;
	entry->u.nvme.ns = ns;
	entry->num_io_requests = entries;
	entry->num_io_requests = g_queue_depth * entries;

	entry->size_in_ios = ns_size / g_io_size_bytes;
	entry->io_size_blocks = g_io_size_bytes / sector_size;