Deinit cache volume on detach

Signed-off-by: Jan Musial <jan.musial@intel.com>
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Jan Musial 2021-10-26 15:18:25 +02:00 committed by Robert Baldyga
parent 12c8b4e333
commit 55eae1447d

View File

@ -1842,7 +1842,7 @@ static void _ocf_mngt_cache_put_io_queues(ocf_cache_t cache)
ocf_queue_put(queue);
}
static void ocf_mngt_cache_stop_deinit_metadata(ocf_pipeline_t pipeline,
static void ocf_mngt_cache_close_cache_volume(ocf_pipeline_t pipeline,
void *priv, ocf_pipeline_arg_t arg)
{
struct ocf_mngt_cache_stop_context *context = priv;
@ -1850,14 +1850,33 @@ static void ocf_mngt_cache_stop_deinit_metadata(ocf_pipeline_t pipeline,
ocf_volume_close(&cache->device->volume);
ocf_metadata_deinit_variable_size(cache);
ocf_concurrency_deinit(cache);
ocf_pipeline_next(pipeline);
}
static void ocf_mngt_cache_deinit_cache_volume(ocf_pipeline_t pipeline,
void *priv, ocf_pipeline_arg_t arg)
{
struct ocf_mngt_cache_stop_context *context = priv;
ocf_cache_t cache = context->cache;
ocf_volume_deinit(&cache->device->volume);
env_vfree(cache->device);
cache->device = NULL;
ocf_pipeline_next(pipeline);
}
static void ocf_mngt_cache_deinit_metadata(ocf_pipeline_t pipeline,
void *priv, ocf_pipeline_arg_t arg)
{
struct ocf_mngt_cache_stop_context *context = priv;
ocf_cache_t cache = context->cache;
ocf_metadata_deinit_variable_size(cache);
ocf_concurrency_deinit(cache);
/* TODO: this should be removed from detach after 'attached' stats
are better separated in statistics */
env_atomic_set(&cache->fallback_pt_error_counter, 0);
@ -1953,7 +1972,9 @@ struct ocf_pipeline_properties ocf_mngt_cache_stop_pipeline_properties = {
OCF_PL_STEP(ocf_mngt_cache_stop_check_dirty),
OCF_PL_STEP(ocf_mngt_cache_stop_remove_cores),
OCF_PL_STEP(ocf_mngt_cache_stop_unplug),
OCF_PL_STEP(ocf_mngt_cache_stop_deinit_metadata),
OCF_PL_STEP(ocf_mngt_cache_close_cache_volume),
OCF_PL_STEP(ocf_mngt_cache_deinit_metadata),
OCF_PL_STEP(ocf_mngt_cache_deinit_cache_volume),
OCF_PL_STEP(ocf_mngt_cache_stop_put_io_queues),
OCF_PL_STEP_TERMINATOR(),
},
@ -2391,7 +2412,9 @@ ocf_mngt_cache_stop_standby_pipeline_properties = {
.finish = ocf_mngt_cache_stop_finish,
.steps = {
OCF_PL_STEP(ocf_mngt_cache_stop_wait_metadata_io),
OCF_PL_STEP(ocf_mngt_cache_stop_deinit_metadata),
OCF_PL_STEP(ocf_mngt_cache_close_cache_volume),
OCF_PL_STEP(ocf_mngt_cache_deinit_metadata),
OCF_PL_STEP(ocf_mngt_cache_deinit_cache_volume),
OCF_PL_STEP(ocf_mngt_cache_stop_put_io_queues),
OCF_PL_STEP_TERMINATOR(),
},
@ -3342,6 +3365,7 @@ static void ocf_mngt_cache_detach_finish(ocf_pipeline_t pipeline,
ocf_pipeline_destroy(context->pipeline);
ocf_pipeline_destroy(cache->stop_pipeline);
cache->stop_pipeline = NULL;
}
struct ocf_pipeline_properties ocf_mngt_cache_detach_pipeline_properties = {
@ -3354,6 +3378,9 @@ struct ocf_pipeline_properties ocf_mngt_cache_detach_pipeline_properties = {
OCF_PL_STEP(ocf_mngt_cache_stop_check_dirty),
OCF_PL_STEP(ocf_mngt_cache_detach_update_metadata),
OCF_PL_STEP(ocf_mngt_cache_detach_unplug),
OCF_PL_STEP(ocf_mngt_cache_close_cache_volume),
OCF_PL_STEP(ocf_mngt_cache_deinit_metadata),
OCF_PL_STEP(ocf_mngt_cache_deinit_cache_volume),
OCF_PL_STEP_TERMINATOR(),
},
};