Commit d07dc4d3 authored by Jim Harris's avatar Jim Harris
Browse files

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: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: Ibac864836f94994cdd24a7886894778268b14f73
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10674


Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJohn Kariuki <John.K.Kariuki@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarDong Yi <dongx.yi@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 050565e5
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -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);
	}