Commit 48cf3e9b authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Jim Harris
Browse files

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: default avatarShuhei 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: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
parent 61532e08
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -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)) {