ocf: stop cache immediately at shutdown
Change shutdown behavior such that now first bdev destruct() call
stops OCF cache instance.
Previusly, cache was stopped when single vbdev was referencing it.
This patch is related to persistent metadata support.
Without this change, every time a SPDK application is stopped,
only the last core is remembered in metadata,
because vbdevs detach by 1 by 1, each time updating the metadata.
Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455413 (master)
(cherry picked from commit 1292ef24e7
)
Change-Id: I57db3f77db525177c024ee85e660a85aff2f8c31
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457267
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
ce3ffa45ed
commit
624769671d
@ -56,6 +56,8 @@ static TAILQ_HEAD(, vbdev_ocf) g_ocf_vbdev_head
|
||||
static TAILQ_HEAD(, examining_bdev) g_ocf_examining_bdevs_head
|
||||
= TAILQ_HEAD_INITIALIZER(g_ocf_examining_bdevs_head);
|
||||
|
||||
bool g_fini_started = false;
|
||||
|
||||
/* Structure for keeping list of bdevs that are claimed but not used yet */
|
||||
struct examining_bdev {
|
||||
struct spdk_bdev *bdev;
|
||||
@ -264,7 +266,7 @@ stop_vbdev_poll(struct vbdev_ocf *vbdev)
|
||||
return;
|
||||
}
|
||||
|
||||
if (get_other_cache_instance(vbdev)) {
|
||||
if (!g_fini_started && get_other_cache_instance(vbdev)) {
|
||||
SPDK_NOTICELOG("Not stopping cache instance '%s'"
|
||||
" because it is referenced by other OCF bdev\n",
|
||||
vbdev->cache.name);
|
||||
@ -1426,12 +1428,18 @@ vbdev_ocf_get_ctx_size(void)
|
||||
return sizeof(struct bdev_ocf_data);
|
||||
}
|
||||
|
||||
static void
|
||||
fini_start(void)
|
||||
{
|
||||
g_fini_started = true;
|
||||
}
|
||||
|
||||
/* Module-global function table
|
||||
* Does not relate to vbdev instances */
|
||||
static struct spdk_bdev_module ocf_if = {
|
||||
.name = "ocf",
|
||||
.module_init = vbdev_ocf_init,
|
||||
.fini_start = NULL,
|
||||
.fini_start = fini_start,
|
||||
.module_fini = vbdev_ocf_module_fini,
|
||||
.config_text = NULL,
|
||||
.get_ctx_size = vbdev_ocf_get_ctx_size,
|
||||
|
Loading…
Reference in New Issue
Block a user