From 48cf3e9bbd0d17f89dc6ed69a937db303766e8cf Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Sun, 28 Mar 2021 11:36:46 +0900 Subject: [PATCH] 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 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 Reviewed-by: Jim Harris Reviewed-by: Paul Luse Reviewed-by: Aleksey Marchuk --- module/bdev/nvme/common.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/module/bdev/nvme/common.c b/module/bdev/nvme/common.c index bdc3c1f13..1cfe580f7 100644 --- a/module/bdev/nvme/common.c +++ b/module/bdev/nvme/common.c @@ -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)) {