bdev/nvme: move module finish callback to nvme_ctrlr_delete

This is done in preparation for using the non-blocking versions of the
spdk_nvme_detach API, which will delay controller's delation until the
detach is completed asynchronously.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: Ia785408c9a94427e60bf239e6036a5e89d589f61
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8727
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Konrad Sztyber 2021-07-08 13:35:21 +02:00 committed by Tomasz Zawadzki
parent c1f6054114
commit f983acfc3a

View File

@ -441,14 +441,6 @@ nvme_ctrlr_delete(struct nvme_ctrlr *nvme_ctrlr)
free(nvme_ctrlr->namespaces);
free(nvme_ctrlr);
}
static void
nvme_ctrlr_unregister_cb(void *io_device)
{
struct nvme_ctrlr *nvme_ctrlr = io_device;
nvme_ctrlr_delete(nvme_ctrlr);
pthread_mutex_lock(&g_bdev_nvme_mutex);
if (g_bdev_nvme_module_finish && TAILQ_EMPTY(&g_nvme_bdev_ctrlrs)) {
@ -457,10 +449,17 @@ nvme_ctrlr_unregister_cb(void *io_device)
spdk_bdev_module_fini_done();
return;
}
pthread_mutex_unlock(&g_bdev_nvme_mutex);
}
static void
nvme_ctrlr_unregister_cb(void *io_device)
{
struct nvme_ctrlr *nvme_ctrlr = io_device;
nvme_ctrlr_delete(nvme_ctrlr);
}
static void
nvme_ctrlr_unregister(void *ctx)
{