Merge pull request #870 from mmichal10/fix-attach-refcnt

Fix attach refcnt
This commit is contained in:
Robert Baldyga 2025-03-25 09:55:55 +01:00 committed by GitHub
commit 71be2d5c1e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 11 deletions

View File

@ -161,7 +161,7 @@ void ocf_resolve_effective_cache_mode(ocf_cache_t cache,
return;
}
if (env_atomic_read(&cache->attach_pt)) {
if (unlikely(env_atomic_read(&cache->attach_pt))) {
req->cache_mode = ocf_req_cache_mode_pt;
return;
}
@ -171,7 +171,7 @@ void ocf_resolve_effective_cache_mode(ocf_cache_t cache,
return;
}
if (req->core_line_count > cache->conf_meta->cachelines) {
if (unlikely(req->core_line_count > cache->conf_meta->cachelines)) {
req->cache_mode = ocf_req_cache_mode_pt;
return;
}

View File

@ -1965,8 +1965,8 @@ static void _ocf_mngt_attach_shutdown_status(ocf_pipeline_t pipeline,
_ocf_mngt_attach_shutdown_status_complete, context);
}
static void _ocf_mngt_attach_post_init_finish(void *priv)
static void _ocf_mngt_attach_disable_pt(ocf_pipeline_t pipeline,
void *priv, ocf_pipeline_arg_t arg)
{
struct ocf_cache_attach_context *context = priv;
ocf_cache_t cache = context->cache;
@ -1980,7 +1980,7 @@ static void _ocf_mngt_attach_post_init_finish(void *priv)
ocf_pipeline_next(context->pipeline);
}
static void _ocf_mngt_attach_post_init(ocf_pipeline_t pipeline,
static void _ocf_mngt_attach_switch_to_pt(ocf_pipeline_t pipeline,
void *priv, ocf_pipeline_arg_t arg)
{
struct ocf_cache_attach_context *context = priv;
@ -1990,10 +1990,9 @@ static void _ocf_mngt_attach_post_init(ocf_pipeline_t pipeline,
ocf_cleaner_refcnt_unfreeze(cache);
env_refcnt_unfreeze(&cache->refcnt.metadata);
env_refcnt_freeze(&cache->refcnt.d2c);
env_refcnt_register_zero_cb(&cache->refcnt.d2c,
_ocf_mngt_attach_post_init_finish, context);
ocf_mngt_continue_pipeline_on_zero_refcnt(&cache->refcnt.d2c, pipeline);
}
static void _ocf_mngt_attach_handle_error(
@ -2080,7 +2079,8 @@ struct ocf_pipeline_properties _ocf_mngt_cache_attach_pipeline_properties = {
OCF_PL_STEP(_ocf_mngt_attach_discard),
OCF_PL_STEP(_ocf_mngt_attach_flush),
OCF_PL_STEP(_ocf_mngt_attach_shutdown_status),
OCF_PL_STEP(_ocf_mngt_attach_post_init),
OCF_PL_STEP(_ocf_mngt_attach_switch_to_pt),
OCF_PL_STEP(_ocf_mngt_attach_disable_pt),
OCF_PL_STEP_TERMINATOR(),
},
};
@ -2107,7 +2107,8 @@ struct ocf_pipeline_properties _ocf_mngt_cache_load_pipeline_properties = {
OCF_PL_STEP(_ocf_mngt_attach_shutdown_status),
OCF_PL_STEP(_ocf_mngt_attach_flush_metadata),
OCF_PL_STEP(_ocf_mngt_attach_shutdown_status),
OCF_PL_STEP(_ocf_mngt_attach_post_init),
OCF_PL_STEP(_ocf_mngt_attach_switch_to_pt),
OCF_PL_STEP(_ocf_mngt_attach_disable_pt),
OCF_PL_STEP_TERMINATOR(),
},
};
@ -2780,7 +2781,8 @@ struct ocf_pipeline_properties _ocf_mngt_cache_activate_pipeline_properties = {
OCF_PL_STEP(_ocf_mngt_load_rebuild_metadata),
OCF_PL_STEP(_ocf_mngt_load_init_cleaning),
OCF_PL_STEP(_ocf_mngt_attach_shutdown_status),
OCF_PL_STEP(_ocf_mngt_attach_post_init),
OCF_PL_STEP(_ocf_mngt_attach_switch_to_pt),
OCF_PL_STEP(_ocf_mngt_attach_disable_pt),
OCF_PL_STEP_TERMINATOR(),
},
};