bdev_nvme: split fini ctrlr destruction to separate function

We will need to add another step in the fini path for
stopping discovery pollers, so this patch prepares for
that.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ifecbbac60262f3aae7f7a7ced09b7a600df7c2e8
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10590
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
Jim Harris 2021-12-07 21:10:54 +00:00 committed by Tomasz Zawadzki
parent 54efe6552b
commit 986f74aead

View File

@ -3873,20 +3873,10 @@ bdev_nvme_library_init(void)
}
static void
bdev_nvme_library_fini(void)
bdev_nvme_fini_destruct_ctrlrs(void)
{
struct nvme_bdev_ctrlr *nbdev_ctrlr;
struct nvme_ctrlr *nvme_ctrlr;
struct nvme_probe_skip_entry *entry, *entry_tmp;
spdk_poller_unregister(&g_hotplug_poller);
free(g_hotplug_probe_ctx);
g_hotplug_probe_ctx = NULL;
TAILQ_FOREACH_SAFE(entry, &g_skipped_nvme_ctrlrs, tailq, entry_tmp) {
TAILQ_REMOVE(&g_skipped_nvme_ctrlrs, entry, tailq);
free(entry);
}
pthread_mutex_lock(&g_bdev_nvme_mutex);
TAILQ_FOREACH(nbdev_ctrlr, &g_nvme_bdev_ctrlrs, tailq) {
@ -3918,6 +3908,23 @@ bdev_nvme_library_fini(void)
pthread_mutex_unlock(&g_bdev_nvme_mutex);
}
static void
bdev_nvme_library_fini(void)
{
struct nvme_probe_skip_entry *entry, *entry_tmp;
spdk_poller_unregister(&g_hotplug_poller);
free(g_hotplug_probe_ctx);
g_hotplug_probe_ctx = NULL;
TAILQ_FOREACH_SAFE(entry, &g_skipped_nvme_ctrlrs, tailq, entry_tmp) {
TAILQ_REMOVE(&g_skipped_nvme_ctrlrs, entry, tailq);
free(entry);
}
bdev_nvme_fini_destruct_ctrlrs();
}
static void
bdev_nvme_verify_pi_error(struct nvme_bdev_io *bio)
{