From a99dd7751fbecc416f85b9b8a0fceeb1f91e25de Mon Sep 17 00:00:00 2001 From: Ziye Yang Date: Sat, 26 Aug 2017 04:12:52 +0800 Subject: [PATCH] fio_plugin: Fix the performance issue on testing multiple remote nvme subsystem The reason is that we create duplicated qpair on same subsystem many times, thus the performance is influenced. And this patch can fix this issue. Change-Id: I075b028b15e0d34857a89510710642f2d9520235 Signed-off-by: Ziye Yang Reviewed-on: https://review.gerrithub.io/375782 Tested-by: SPDK Automated Test System Reviewed-by: Daniel Verkamp Reviewed-by: Jim Harris --- examples/nvme/fio_plugin/fio_plugin.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/nvme/fio_plugin/fio_plugin.c b/examples/nvme/fio_plugin/fio_plugin.c index 418cf94d5..c4a296a2d 100644 --- a/examples/nvme/fio_plugin/fio_plugin.c +++ b/examples/nvme/fio_plugin/fio_plugin.c @@ -74,6 +74,7 @@ struct spdk_fio_qpair { struct spdk_nvme_qpair *qpair; struct spdk_nvme_ns *ns; struct spdk_fio_qpair *next; + struct spdk_fio_ctrlr *fio_ctrlr; }; struct spdk_fio_thread { @@ -156,7 +157,9 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid, fio_qpair = fio_thread->fio_qpair; while (fio_qpair != NULL) { - if (fio_qpair->f == f) { + if ((fio_qpair->f == f) || + ((spdk_nvme_transport_id_compare(trid, &fio_qpair->fio_ctrlr->tr_id) == 0) && + (spdk_nvme_ns_get_id(fio_qpair->ns) == ns_id))) { return; } fio_qpair = fio_qpair->next; @@ -171,6 +174,7 @@ attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid, fio_qpair->qpair = spdk_nvme_ctrlr_alloc_io_qpair(fio_ctrlr->ctrlr, NULL, 0); fio_qpair->ns = ns; fio_qpair->f = f; + fio_qpair->fio_ctrlr = fio_ctrlr; fio_qpair->next = fio_thread->fio_qpair; fio_thread->fio_qpair = fio_qpair;