Freeze / unfreeze cleaning reference counters in detach/attach
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
parent
348b0f9ab8
commit
af4b9b13d0
@ -209,6 +209,8 @@ static void __init_partitions(ocf_cache_t cache)
|
|||||||
|
|
||||||
/* Add other partition to the cache and make it as dummy */
|
/* Add other partition to the cache and make it as dummy */
|
||||||
for (i_part = 0; i_part < OCF_IO_CLASS_MAX; i_part++) {
|
for (i_part = 0; i_part < OCF_IO_CLASS_MAX; i_part++) {
|
||||||
|
ocf_refcnt_freeze(&cache->refcnt.cleaning[i_part]);
|
||||||
|
|
||||||
if (i_part == PARTITION_DEFAULT)
|
if (i_part == PARTITION_DEFAULT)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -1514,6 +1516,7 @@ static void _ocf_mngt_attach_post_init(ocf_pipeline_t pipeline,
|
|||||||
context->flags.cleaner_started = true;
|
context->flags.cleaner_started = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ocf_cleaner_refcnt_unfreeze(cache);
|
||||||
ocf_refcnt_unfreeze(&cache->refcnt.metadata);
|
ocf_refcnt_unfreeze(&cache->refcnt.metadata);
|
||||||
|
|
||||||
ocf_pipeline_next(context->pipeline);
|
ocf_pipeline_next(context->pipeline);
|
||||||
@ -2285,6 +2288,7 @@ struct ocf_mngt_cache_detach_context {
|
|||||||
ocf_pipeline_t pipeline;
|
ocf_pipeline_t pipeline;
|
||||||
ocf_cache_t cache;
|
ocf_cache_t cache;
|
||||||
int cache_write_error;
|
int cache_write_error;
|
||||||
|
struct ocf_cleaner_wait_context cleaner_wait;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void ocf_mngt_cache_detach_flush_cmpl(ocf_cache_t cache,
|
static void ocf_mngt_cache_detach_flush_cmpl(ocf_cache_t cache,
|
||||||
@ -2305,13 +2309,13 @@ static void ocf_mngt_cache_detach_flush(ocf_pipeline_t pipeline,
|
|||||||
context);
|
context);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ocf_mngt_cache_detach_wait_pending_finish(void *priv)
|
static void ocf_mngt_cache_detach_stop_cache_io_finish(void *priv)
|
||||||
{
|
{
|
||||||
struct ocf_mngt_cache_detach_context *context = priv;
|
struct ocf_mngt_cache_detach_context *context = priv;
|
||||||
ocf_pipeline_next(context->pipeline);
|
ocf_pipeline_next(context->pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ocf_mngt_cache_detach_wait_pending(ocf_pipeline_t pipeline,
|
static void ocf_mngt_cache_detach_stop_cache_io(ocf_pipeline_t pipeline,
|
||||||
void *priv, ocf_pipeline_arg_t arg)
|
void *priv, ocf_pipeline_arg_t arg)
|
||||||
{
|
{
|
||||||
struct ocf_mngt_cache_detach_context *context = priv;
|
struct ocf_mngt_cache_detach_context *context = priv;
|
||||||
@ -2319,7 +2323,25 @@ static void ocf_mngt_cache_detach_wait_pending(ocf_pipeline_t pipeline,
|
|||||||
|
|
||||||
ocf_refcnt_freeze(&cache->refcnt.metadata);
|
ocf_refcnt_freeze(&cache->refcnt.metadata);
|
||||||
ocf_refcnt_register_zero_cb(&cache->refcnt.metadata,
|
ocf_refcnt_register_zero_cb(&cache->refcnt.metadata,
|
||||||
ocf_mngt_cache_detach_wait_pending_finish, context);
|
ocf_mngt_cache_detach_stop_cache_io_finish, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ocf_mngt_cache_detach_stop_cleaner_io_finish(void *priv)
|
||||||
|
{
|
||||||
|
ocf_pipeline_t pipeline = priv;
|
||||||
|
ocf_pipeline_next(pipeline);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ocf_mngt_cache_detach_stop_cleaner_io(ocf_pipeline_t pipeline,
|
||||||
|
void *priv, ocf_pipeline_arg_t arg)
|
||||||
|
{
|
||||||
|
struct ocf_mngt_cache_detach_context *context = priv;
|
||||||
|
ocf_cache_t cache = context->cache;
|
||||||
|
|
||||||
|
ocf_cleaner_refcnt_freeze(cache);
|
||||||
|
ocf_cleaner_refcnt_register_zero_cb(cache, &context->cleaner_wait,
|
||||||
|
ocf_mngt_cache_detach_stop_cleaner_io_finish,
|
||||||
|
pipeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ocf_mngt_cache_detach_update_metadata(ocf_pipeline_t pipeline,
|
static void ocf_mngt_cache_detach_update_metadata(ocf_pipeline_t pipeline,
|
||||||
@ -2399,7 +2421,8 @@ struct ocf_pipeline_properties ocf_mngt_cache_detach_pipeline_properties = {
|
|||||||
.finish = ocf_mngt_cache_detach_finish,
|
.finish = ocf_mngt_cache_detach_finish,
|
||||||
.steps = {
|
.steps = {
|
||||||
OCF_PL_STEP(ocf_mngt_cache_detach_flush),
|
OCF_PL_STEP(ocf_mngt_cache_detach_flush),
|
||||||
OCF_PL_STEP(ocf_mngt_cache_detach_wait_pending),
|
OCF_PL_STEP(ocf_mngt_cache_detach_stop_cache_io),
|
||||||
|
OCF_PL_STEP(ocf_mngt_cache_detach_stop_cleaner_io),
|
||||||
OCF_PL_STEP(ocf_mngt_cache_detach_update_metadata),
|
OCF_PL_STEP(ocf_mngt_cache_detach_update_metadata),
|
||||||
OCF_PL_STEP(ocf_mngt_cache_detach_unplug),
|
OCF_PL_STEP(ocf_mngt_cache_detach_unplug),
|
||||||
OCF_PL_STEP_TERMINATOR(),
|
OCF_PL_STEP_TERMINATOR(),
|
||||||
|
Loading…
Reference in New Issue
Block a user