bdev/nvme: use g_nvme_bdev_ctrlrs as the poll group io device

IO device "bdev_nvme_poll_groups" is not unregistered in the finish
module, so we need to unregister this io device, since the "nvme_if"
is staic variable in bdev_nvme.c, it's can't be accessed in common.c
so we use "g_nvme_bdev_ctrlrs" instead.

Change-Id: Id4675f5acc8f386609903497da5ca84bf8af3a15
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2035
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Seth Howell <seth.howell@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
Changpeng Liu 2020-04-25 20:38:30 -04:00 committed by Tomasz Zawadzki
parent 5d0718528d
commit 597a7d08b5
2 changed files with 5 additions and 2 deletions

View File

@ -728,7 +728,7 @@ bdev_nvme_create_cb(void *io_device, void *ctx_buf)
}
}
pg_ch = spdk_get_io_channel(&nvme_if);
pg_ch = spdk_get_io_channel(&g_nvme_bdev_ctrlrs);
if (!pg_ch) {
goto err;
}
@ -1817,7 +1817,8 @@ bdev_nvme_library_init(void)
g_bdev_nvme_init_thread = spdk_get_thread();
spdk_io_device_register(&nvme_if, bdev_nvme_poll_group_create_cb, bdev_nvme_poll_group_destroy_cb,
spdk_io_device_register(&g_nvme_bdev_ctrlrs, bdev_nvme_poll_group_create_cb,
bdev_nvme_poll_group_destroy_cb,
sizeof(struct nvme_bdev_poll_group), "bdev_nvme_poll_groups");
sp = spdk_conf_find_section(NULL, "Nvme");
@ -2063,6 +2064,7 @@ bdev_nvme_library_fini(void)
g_bdev_nvme_module_finish = true;
if (TAILQ_EMPTY(&g_nvme_bdev_ctrlrs)) {
pthread_mutex_unlock(&g_bdev_nvme_mutex);
spdk_io_device_unregister(&g_nvme_bdev_ctrlrs, NULL);
spdk_bdev_module_finish_done();
return;
}

View File

@ -133,6 +133,7 @@ nvme_bdev_unregister_cb(void *io_device)
pthread_mutex_lock(&g_bdev_nvme_mutex);
if (g_bdev_nvme_module_finish && TAILQ_EMPTY(&g_nvme_bdev_ctrlrs)) {
pthread_mutex_unlock(&g_bdev_nvme_mutex);
spdk_io_device_unregister(&g_nvme_bdev_ctrlrs, NULL);
spdk_bdev_module_finish_done();
return;
}