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

@@ -316,6 +316,7 @@ int cleaning_policy_acp_initialize(struct ocf_cache *cache,
}
_acp_rebuild(cache);
ocf_kick_cleaner(cache);
return 0;
}
@@ -336,6 +337,7 @@ int cleaning_policy_acp_set_cleaning_param(ocf_cache_t cache,
config->thread_wakeup_time = param_value;
ocf_cache_log(cache, log_info, "Write-back flush thread "
"wake-up time: %d\n", config->thread_wakeup_time);
ocf_kick_cleaner(cache);
break;
case ocf_acp_flush_max_buffers:
OCF_CLEANING_CHECK_PARAM(cache, param_value,

View File

@@ -470,6 +470,8 @@ int cleaning_policy_alru_initialize(ocf_cache_t cache, int init_metadata)
if (init_metadata)
_alru_rebuild(cache);
ocf_kick_cleaner(cache);
return 0;
}
@@ -495,6 +497,7 @@ int cleaning_policy_alru_set_cleaning_param(ocf_cache_t cache,
config->thread_wakeup_time = param_value;
ocf_cache_log(cache, log_info, "Write-back flush thread "
"wake-up time: %d\n", config->thread_wakeup_time);
ocf_kick_cleaner(cache);
break;
case ocf_alru_stale_buffer_time:
OCF_CLEANING_CHECK_PARAM(cache, param_value,

View File

@@ -59,6 +59,11 @@ void ocf_stop_cleaner(ocf_cache_t cache)
ctx_cleaner_stop(cache->owner, &cache->cleaner);
}
void ocf_kick_cleaner(ocf_cache_t cache)
{
ctx_cleaner_kick(cache->owner, &cache->cleaner);
}
void ocf_cleaner_set_cmpl(ocf_cleaner_t cleaner, ocf_cleaner_end_t fn)
{
cleaner->end = fn;

View File

@@ -68,6 +68,8 @@ struct ocf_cleaner {
int ocf_start_cleaner(ocf_cache_t cache);
void ocf_kick_cleaner(ocf_cache_t cache);
void ocf_stop_cleaner(ocf_cache_t cache);
#endif

View File

@@ -9,6 +9,5 @@
void cleaning_nop_perform_cleaning(ocf_cache_t cache, ocf_cleaner_end_t cmpl)
{
uint32_t interval = SLEEP_TIME_MS;
cmpl(&cache->cleaner, interval);
cmpl(&cache->cleaner, OCF_CLEANER_DISABLE);
}