bdev/ftl: Initialize a nvme_bdev_ctrlr name

Change-Id: I9d7de9a41762fd6e9484a289eda076c352310eda
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/447433
Reviewed-by: Maciej Szwed <maciej.szwed@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Wojciech Malikowski 2019-03-08 05:23:11 -05:00 committed by Darek Stojaczyk
parent 136c3fb461
commit 6cc1b3630f

View File

@ -134,6 +134,14 @@ bdev_ftl_add_ctrlr(struct spdk_nvme_ctrlr *ctrlr, const struct spdk_nvme_transpo
ftl_ctrlr->trid = *trid;
ftl_ctrlr->ref = 1;
ftl_ctrlr->name = spdk_sprintf_alloc("NVMe_%s", trid->traddr);
if (!ftl_ctrlr->name) {
SPDK_ERRLOG("Unable to allocate memory for bdev controller name.\n");
free(ftl_ctrlr);
ftl_ctrlr = NULL;
goto out;
}
TAILQ_INSERT_HEAD(&g_nvme_bdev_ctrlrs, ftl_ctrlr, tailq);
}
out:
@ -153,6 +161,7 @@ bdev_ftl_remove_ctrlr(struct nvme_bdev_ctrlr *ctrlr)
}
TAILQ_REMOVE(&g_nvme_bdev_ctrlrs, ctrlr, tailq);
free(ctrlr->name);
free(ctrlr);
}
out: