nvme/fio: free io_qpairs in close callback

If user uses the 'loops' parameter, then it will
call the open+close callbacks for each loop, but only
cleanup at the end of the entire run. Since we alloc
the io_qpair in open, but don't free them until
cleanup, we end up running out of io qpairs at some
point if we run too many loops.

So solution is to free the io qpairs in the close
callback.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ibac864836f94994cdd24a7886894778268b14f73
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10674
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: John Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Dong Yi <dongx.yi@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Jim Harris 2021-12-14 15:49:02 +00:00
parent 050565e5ab
commit d07dc4d361

View File

@ -711,6 +711,7 @@ static int spdk_fio_open(struct thread_data *td, struct fio_file *f)
struct spdk_fio_options *fio_options = td->eo;
struct spdk_nvme_io_qpair_opts qpopts;
assert(fio_qpair->qpair == NULL);
spdk_nvme_ctrlr_get_default_io_qpair_opts(fio_ctrlr->ctrlr, &qpopts, sizeof(qpopts));
qpopts.delay_cmd_submit = true;
if (fio_options->enable_wrr) {
@ -735,6 +736,11 @@ static int spdk_fio_open(struct thread_data *td, struct fio_file *f)
static int spdk_fio_close(struct thread_data *td, struct fio_file *f)
{
struct spdk_fio_qpair *fio_qpair = f->engine_data;
assert(fio_qpair->qpair != NULL);
spdk_nvme_ctrlr_free_io_qpair(fio_qpair->qpair);
fio_qpair->qpair = NULL;
return 0;
}
@ -1426,7 +1432,6 @@ static void spdk_fio_cleanup(struct thread_data *td)
TAILQ_FOREACH_SAFE(fio_qpair, &fio_thread->fio_qpair, link, fio_qpair_tmp) {
TAILQ_REMOVE(&fio_thread->fio_qpair, fio_qpair, link);
spdk_nvme_ctrlr_free_io_qpair(fio_qpair->qpair);
free(fio_qpair);
}