bdev/nvme: Factor out deleting nvme_bdev_ctrlr into a helper function

This change will make the the upcoming changes a little easier.

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I51776c8ab91a0dfd9150f17e567f8be795b9f4b5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7046
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
Shuhei Matsumoto 2021-03-28 11:36:46 +09:00 committed by Jim Harris
parent 61532e08ed
commit 48cf3e9bbd

View File

@ -113,9 +113,8 @@ nvme_bdev_dump_trid_json(const struct spdk_nvme_transport_id *trid, struct spdk_
}
static void
nvme_bdev_ctrlr_unregister_cb(void *io_device)
nvme_bdev_ctrlr_delete(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr)
{
struct nvme_bdev_ctrlr *nvme_bdev_ctrlr = io_device;
struct nvme_bdev_ctrlr_trid *trid, *tmp_trid;
uint32_t i;
@ -147,6 +146,14 @@ nvme_bdev_ctrlr_unregister_cb(void *io_device)
free(nvme_bdev_ctrlr->namespaces);
free(nvme_bdev_ctrlr);
}
static void
nvme_bdev_ctrlr_unregister_cb(void *io_device)
{
struct nvme_bdev_ctrlr *nvme_bdev_ctrlr = io_device;
nvme_bdev_ctrlr_delete(nvme_bdev_ctrlr);
pthread_mutex_lock(&g_bdev_nvme_mutex);
if (g_bdev_nvme_module_finish && TAILQ_EMPTY(&g_nvme_bdev_ctrlrs)) {