nvme: use asynchronous probe API in spdk_nvme_connect()

Change-Id: Ib7b21dc64c2d5a5594b05b4d8ade839fc4b06fbc
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/447023
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Changpeng Liu 2019-03-04 23:36:38 -05:00 committed by Jim Harris
parent 84245b7202
commit 1151e65dc1

View File

@ -635,7 +635,6 @@ spdk_nvme_connect(const struct spdk_nvme_transport_id *trid,
{
int rc;
struct spdk_nvme_ctrlr *ctrlr = NULL;
spdk_nvme_probe_cb probe_cb = NULL;
struct spdk_nvme_probe_ctx *probe_ctx;
if (trid == NULL) {
@ -643,21 +642,16 @@ spdk_nvme_connect(const struct spdk_nvme_transport_id *trid,
return NULL;
}
rc = nvme_driver_init();
if (rc != 0) {
if (opts && (opts_size != sizeof(*opts))) {
SPDK_ERRLOG("Invalid opts size\n");
return NULL;
}
if (opts && opts_size == sizeof(*opts)) {
probe_cb = spdk_nvme_connect_probe_cb;
}
probe_ctx = calloc(1, sizeof(*probe_ctx));
probe_ctx = spdk_nvme_connect_async(trid, opts, NULL);
if (!probe_ctx) {
SPDK_ERRLOG("Create probe context failed\n");
return NULL;
}
spdk_nvme_probe_ctx_init(probe_ctx, trid, (void *)opts, probe_cb, NULL, NULL);
spdk_nvme_probe_internal(probe_ctx, true);
rc = nvme_init_controllers(probe_ctx);
if (rc != 0) {