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: Changpeng Liu <changpeng.liu@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/446820 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
030fb5e2bb
commit
9e37807399
@ -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.
|
||||
*/
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user