Commit 9e378073 authored by Changpeng Liu's avatar Changpeng Liu
Browse files

nvme: free probe context for asynchronous probe API



Free the probe context after the controllers in the probe
context list become READY.  Then users don't need to free
the context which is allocated by SPDK driver.

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


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 030fb5e2
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -612,8 +612,8 @@ struct spdk_nvme_probe_ctx *spdk_nvme_probe_async(const struct spdk_nvme_transpo
 *
 * \param probe_ctx Context used to track probe actions.
 *
 * \return true if all probe operations are complete; the probe_ctx may be
 *              discarded at this point.
 * \return true if all probe operations are complete; the probe_ctx
 * is also freed and no longer valid.
 * \return false if there are still pending probe operations; user must call
 *               spdk_nvme_probe_poll_async again to continue progress.
 */
+2 −0
Original line number Diff line number Diff line
@@ -1098,6 +1098,7 @@ spdk_nvme_probe_poll_async(struct spdk_nvme_probe_ctx *probe_ctx)
	struct spdk_nvme_ctrlr *ctrlr, *ctrlr_tmp;

	if (!spdk_process_is_primary() && probe_ctx->trid.trtype == SPDK_NVME_TRANSPORT_PCIE) {
		free(probe_ctx);
		return true;
	}

@@ -1109,6 +1110,7 @@ spdk_nvme_probe_poll_async(struct spdk_nvme_probe_ctx *probe_ctx)
		nvme_robust_mutex_lock(&g_spdk_nvme_driver->lock);
		g_spdk_nvme_driver->initialized = true;
		nvme_robust_mutex_unlock(&g_spdk_nvme_driver->lock);
		free(probe_ctx);
		return true;
	}
	return false;