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: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/440457
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Changpeng Liu 2019-01-17 20:01:38 -05:00 committed by Jim Harris
parent aff99b6f4d
commit edb6e5b45a

View File

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