lib/bdev: added spdk_bdev_module_fini_done()

Callback for bdev modules is called 'module_fini',
meanwhile after its execution bdev modules were to call
'spdk_bdev_module_finish_done()'.

This function carries incorrect name, so it was deprecated
and replaced with 'spdk_bdev_module_fini_done()'.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I9a12dff746ea8b4b1570a3794470f7b24e29003e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9148
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
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: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Tomasz Zawadzki 2021-08-10 09:30:42 -04:00
parent 413d25b036
commit 511fe15531
14 changed files with 35 additions and 26 deletions

View File

@ -14,6 +14,9 @@ can't be accessed directly.
Added `async_fini_start` to allow bdev modules to complete the `fini_start` asynchronously,
with new `spdk_bdev_module_fini_start_done` API.
Deprecated `spdk_bdev_module_finish_done()` API, which will be removed in SPDK 22.01.
Bdev modules should use `spdk_bdev_module_fini_done()` instead.
### dma
A new library, lib/dma, has been added. This library provides the necessary infrastructure for

View File

@ -11,3 +11,8 @@ Specific future SPDK release for the removal must be provided.
ABI cannot be removed without providing deprecation notice for at least single SPDK release.
# Deprecation Notices {#deprecation-notices}
## bdev
Deprecated `spdk_bdev_module_finish_done()` API, which will be removed in SPDK 22.01.
Bdev modules should use `spdk_bdev_module_fini_done()` instead.

View File

@ -837,7 +837,8 @@ void spdk_bdev_module_init_done(struct spdk_bdev_module *module);
* To be called in response to the module_fini, only if async_fini is set.
*
*/
void spdk_bdev_module_finish_done(void);
void spdk_bdev_module_fini_done(void);
void spdk_bdev_module_finish_done(void); /* Deprecated */
/**
* Indicate that the module fini start has completed.

View File

@ -1498,7 +1498,7 @@ bdev_mgr_unregister_cb(void *io_device)
}
static void
bdev_module_finish_iter(void *arg)
bdev_module_fini_iter(void *arg)
{
struct spdk_bdev_module *bdev_module;
@ -1525,7 +1525,7 @@ bdev_module_finish_iter(void *arg)
/* Save our place so we can resume later. We must
* save the variable here, before calling module_fini()
* below, because in some cases the module may immediately
* call spdk_bdev_module_finish_done() and re-enter
* call spdk_bdev_module_fini_done() and re-enter
* this function to continue iterating. */
g_resume_bdev_module = bdev_module;
}
@ -1547,15 +1547,23 @@ bdev_module_finish_iter(void *arg)
}
void
spdk_bdev_module_finish_done(void)
spdk_bdev_module_fini_done(void)
{
if (spdk_get_thread() != g_fini_thread) {
spdk_thread_send_msg(g_fini_thread, bdev_module_finish_iter, NULL);
spdk_thread_send_msg(g_fini_thread, bdev_module_fini_iter, NULL);
} else {
bdev_module_finish_iter(NULL);
bdev_module_fini_iter(NULL);
}
}
/* Deprecated */
void
spdk_bdev_module_finish_done(void)
{
SPDK_NOTICELOG("spdk_bdev_module_finish_done() is deprecated, please use spdk_bdev_module_fini_done().\n");
spdk_bdev_module_fini_done();
}
static void
bdev_finish_unregister_bdevs_iter(void *cb_arg, int bdeverrno)
{
@ -1580,7 +1588,7 @@ bdev_finish_unregister_bdevs_iter(void *cb_arg, int bdeverrno)
* (like bdev part free) that will use this bdev (or private bdev driver ctx data)
* after returning.
*/
spdk_thread_send_msg(spdk_get_thread(), bdev_module_finish_iter, NULL);
spdk_thread_send_msg(spdk_get_thread(), bdev_module_fini_iter, NULL);
return;
}

View File

@ -104,6 +104,7 @@
spdk_bdev_destruct_done;
spdk_bdev_module_examine_done;
spdk_bdev_module_init_done;
spdk_bdev_module_fini_done;
spdk_bdev_module_finish_done;
spdk_bdev_module_fini_start_done;
spdk_bdev_module_claim_bdev;

View File

@ -452,7 +452,7 @@ static void
_bdev_null_finish_cb(void *arg)
{
spdk_free(g_null_read_buf);
spdk_bdev_module_finish_done();
spdk_bdev_module_fini_done();
}
static void

View File

@ -2827,7 +2827,7 @@ bdev_nvme_library_fini(void)
if (TAILQ_EMPTY(&g_nvme_ctrlrs)) {
pthread_mutex_unlock(&g_bdev_nvme_mutex);
spdk_io_device_unregister(&g_nvme_ctrlrs, NULL);
spdk_bdev_module_finish_done();
spdk_bdev_module_fini_done();
return;
}

View File

@ -166,7 +166,7 @@ nvme_ctrlr_unregister_cb(void *io_device)
if (g_bdev_nvme_module_finish && TAILQ_EMPTY(&g_nvme_ctrlrs)) {
pthread_mutex_unlock(&g_bdev_nvme_mutex);
spdk_io_device_unregister(&g_nvme_ctrlrs, NULL);
spdk_bdev_module_finish_done();
spdk_bdev_module_fini_done();
return;
}

View File

@ -423,7 +423,7 @@ bdev_pmem_initialize(void)
static void
bdev_pmem_finish_done(void *io_device)
{
spdk_bdev_module_finish_done();
spdk_bdev_module_fini_done();
}
static void

View File

@ -1734,7 +1734,7 @@ _virtio_scsi_dev_unregister_cb(void *io_device)
finish_module = TAILQ_EMPTY(&g_virtio_scsi_devs);
if (g_bdev_virtio_finish && finish_module) {
spdk_bdev_module_finish_done();
spdk_bdev_module_fini_done();
}
}
@ -1793,7 +1793,7 @@ bdev_virtio_finish(void)
pthread_mutex_lock(&g_virtio_scsi_mutex);
if (TAILQ_EMPTY(&g_virtio_scsi_devs)) {
pthread_mutex_unlock(&g_virtio_scsi_mutex);
spdk_bdev_module_finish_done();
spdk_bdev_module_fini_done();
return;
}

View File

@ -199,7 +199,7 @@ DEFINE_STUB(spdk_nvme_zns_offline_zone, int,
(struct spdk_nvme_ns *ns, struct spdk_nvme_qpair *qpair, uint64_t slba,
bool select_all, spdk_nvme_cmd_cb cb_fn, void *cb_arg), 0);
DEFINE_STUB_V(spdk_bdev_module_finish_done, (void));
DEFINE_STUB_V(spdk_bdev_module_fini_done, (void));
DEFINE_STUB_V(spdk_bdev_module_list_add, (struct spdk_bdev_module *bdev_module));

View File

@ -57,7 +57,7 @@ DEFINE_STUB(spdk_bdev_push_media_events, int, (struct spdk_bdev *bdev,
const struct spdk_bdev_media_event *events,
size_t num_events), 0);
DEFINE_STUB_V(spdk_bdev_notify_media_management, (struct spdk_bdev *bdev));
DEFINE_STUB_V(spdk_bdev_module_finish_done, (void));
DEFINE_STUB_V(spdk_bdev_module_fini_done, (void));
DEFINE_STUB(spdk_nvme_transport_id_trtype_str, const char *, (enum spdk_nvme_transport_type trtype),
NULL);
DEFINE_STUB(spdk_nvme_transport_id_adrfam_str, const char *, (enum spdk_nvmf_adrfam adrfam), NULL);

View File

@ -38,6 +38,8 @@
#include "bdev/pmem/bdev_pmem.c"
DEFINE_STUB_V(spdk_bdev_module_fini_done, (void));
static struct spdk_bdev_module *g_bdev_pmem_module;
static int g_bdev_module_cnt;
@ -271,11 +273,6 @@ spdk_bdev_unregister(struct spdk_bdev *bdev, spdk_bdev_unregister_cb cb_fn, void
{
}
void
spdk_bdev_module_finish_done(void)
{
}
int
spdk_bdev_notify_blockcnt_change(struct spdk_bdev *bdev, uint64_t size)
{

View File

@ -283,12 +283,6 @@ spdk_bdev_unregister(struct spdk_bdev *vbdev, spdk_bdev_unregister_cb cb_fn, voi
CU_ASSERT(rc == 1);
}
void
spdk_bdev_module_finish_done(void)
{
return;
}
uint64_t
spdk_bs_get_page_size(struct spdk_blob_store *bs)
{