Add kick function for cleaner

ocf_kick_cleaner() allows to perfom cleaning immediately.

Nop cleaning policy now returns new 'OCF_CLEANER_DISABLE' macro which indicates
that cleaing shouldn't be performed. To enable it back, ocf_kick_cleaner()
should be called.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk
2019-03-14 04:49:52 -04:00
parent 94ef5a5249
commit 7165bc16c3
10 changed files with 51 additions and 15 deletions

View File

@@ -1347,6 +1347,15 @@ static void _ocf_mngt_attach_init_instance(ocf_pipeline_t pipeline,
{
struct ocf_cache_attach_context *context = priv;
ocf_cache_t cache = context->cache;
int result;
result = ocf_start_cleaner(cache);
if (result) {
ocf_cache_log(cache, log_err,
"Error while starting cleaner\n");
OCF_PL_FINISH_RET(context->pipeline, result);
}
context->flags.cleaner_started = true;
switch (cache->device->init_mode) {
case ocf_init_mode_init:
@@ -1503,17 +1512,6 @@ static void _ocf_mngt_attach_post_init(ocf_pipeline_t pipeline,
{
struct ocf_cache_attach_context *context = priv;
ocf_cache_t cache = context->cache;
int result;
if (!context->flags.cleaner_started) {
result = ocf_start_cleaner(cache);
if (result) {
ocf_cache_log(cache, log_err,
"Error while starting cleaner\n");
OCF_PL_FINISH_RET(context->pipeline, result);
}
context->flags.cleaner_started = true;
}
ocf_cleaner_refcnt_unfreeze(cache);
ocf_refcnt_unfreeze(&cache->refcnt.metadata);