bdev/nvme: Rename nvme_bdev_ctrlr_destruct() by nvme_bdev_ctrlr_release()

The reference count of nvme_bdev_ctrlr will be used to update ANA log
page safely, and nvme_bdev_ctrlr_destruct() can be used to decrement
reference count after completing ANA log page update.

However, nvme_bdev_ctrlr_destruct() is not a good name for this case.
Furthermore, nvme_bdev_ctrlr_destruct() does not set the destruct flag
to true, and the next patch will need nvme_bdev_ctrlr_acquire().

Hence rename nvme_bdev_ctrlr_destruct() by nvme_bdev_ctrlr_release().

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I285b7ab0963d0f4ea4a7a9fd29bd026d37ba8460
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8334
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Shuhei Matsumoto 2021-06-15 00:15:21 +09:00 committed by Tomasz Zawadzki
parent 0f4cebebbf
commit e6a9c4042d
5 changed files with 7 additions and 7 deletions

View File

@ -369,7 +369,7 @@ bdev_nvme_destruct(void *ctx)
if (!nvme_ns->populated) {
pthread_mutex_unlock(&nvme_ns->ctrlr->mutex);
nvme_bdev_ctrlr_destruct(nvme_ns->ctrlr);
nvme_bdev_ctrlr_release(nvme_ns->ctrlr);
} else {
pthread_mutex_unlock(&nvme_ns->ctrlr->mutex);
}
@ -1961,7 +1961,7 @@ _nvme_bdev_ctrlr_destruct(void *ctx)
struct nvme_bdev_ctrlr *nvme_bdev_ctrlr = ctx;
nvme_ctrlr_depopulate_namespaces(nvme_bdev_ctrlr);
nvme_bdev_ctrlr_destruct(nvme_bdev_ctrlr);
nvme_bdev_ctrlr_release(nvme_bdev_ctrlr);
}
static int

View File

@ -238,7 +238,7 @@ bdev_ocssd_destruct(void *ctx)
if (!nvme_ns->populated) {
pthread_mutex_unlock(&nvme_ns->ctrlr->mutex);
nvme_bdev_ctrlr_destruct(nvme_ns->ctrlr);
nvme_bdev_ctrlr_release(nvme_ns->ctrlr);
} else {
pthread_mutex_unlock(&nvme_ns->ctrlr->mutex);
}

View File

@ -175,7 +175,7 @@ nvme_bdev_ctrlr_unregister(void *ctx)
}
void
nvme_bdev_ctrlr_destruct(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr)
nvme_bdev_ctrlr_release(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr)
{
pthread_mutex_lock(&nvme_bdev_ctrlr->mutex);
@ -210,5 +210,5 @@ nvme_ctrlr_depopulate_namespace_done(struct nvme_bdev_ns *nvme_ns)
}
pthread_mutex_unlock(&nvme_bdev_ctrlr->mutex);
nvme_bdev_ctrlr_destruct(nvme_bdev_ctrlr);
nvme_bdev_ctrlr_release(nvme_bdev_ctrlr);
}

View File

@ -174,7 +174,7 @@ struct nvme_bdev_ctrlr *nvme_bdev_next_ctrlr(struct nvme_bdev_ctrlr *prev);
void nvme_bdev_dump_trid_json(const struct spdk_nvme_transport_id *trid,
struct spdk_json_write_ctx *w);
void nvme_bdev_ctrlr_destruct(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr);
void nvme_bdev_ctrlr_release(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr);
void nvme_bdev_ctrlr_unregister(void *ctx);
void nvme_bdev_ctrlr_delete(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr);

View File

@ -540,7 +540,7 @@ delete_nvme_bdev_controller(struct nvme_bdev_ctrlr *nvme_bdev_ctrlr)
bdev_ocssd_depopulate_namespace(nvme_bdev_ctrlr->namespaces[nsid]);
}
nvme_bdev_ctrlr_destruct(nvme_bdev_ctrlr);
nvme_bdev_ctrlr_release(nvme_bdev_ctrlr);
spdk_delay_us(1000);
while (spdk_thread_poll(g_thread, 0, 0) > 0) {}