Add ocf_cache_set_flush_queue() function
This is needed to enable flushing with dynamic queues. Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
@@ -1060,6 +1060,9 @@ static void _ocf_mngt_init_handle_error(ocf_cache_t cache,
|
||||
|
||||
env_mutex_lock(&ctx->lock);
|
||||
|
||||
if (cache->flush_queue)
|
||||
ocf_queue_put(cache->flush_queue);
|
||||
|
||||
list_for_each_entry_safe(queue, tmp_queue, &cache->io_queues, list)
|
||||
ocf_queue_put(queue);
|
||||
|
||||
@@ -1573,6 +1576,9 @@ static int _ocf_mngt_cache_stop(ocf_cache_t cache)
|
||||
if (env_atomic_read(&cache->attached))
|
||||
result = _ocf_mngt_cache_unplug(cache, true);
|
||||
|
||||
if (cache->flush_queue)
|
||||
ocf_queue_put(cache->flush_queue);
|
||||
|
||||
list_for_each_entry_safe(queue, tmp_queue, &cache->io_queues, list)
|
||||
ocf_queue_put(queue);
|
||||
|
||||
|
@@ -318,7 +318,7 @@ static int _ocf_mngt_flush_containers(ocf_cache_t cache,
|
||||
fctbl[i].attribs.cache_line_lock = true;
|
||||
fctbl[i].attribs.cmpl_context = &fctbl[i];
|
||||
fctbl[i].attribs.cmpl_fn = _ocf_mngt_flush_end;
|
||||
fctbl[i].attribs.io_queue = 0;
|
||||
fctbl[i].attribs.io_queue = cache->flush_queue;
|
||||
fctbl[i].cache = cache;
|
||||
fctbl[i].progress = &progress;
|
||||
fctbl[i].error = &error;
|
||||
@@ -479,6 +479,12 @@ int ocf_mngt_cache_flush(ocf_cache_t cache, bool interruption)
|
||||
return -OCF_ERR_CACHE_IN_INCOMPLETE_STATE;
|
||||
}
|
||||
|
||||
if (!cache->flush_queue) {
|
||||
ocf_cache_log(cache, log_err,
|
||||
"Cannot flush cache - no flush queue set\n");
|
||||
return -OCF_ERR_INVAL;
|
||||
}
|
||||
|
||||
ocf_cache_log(cache, log_info, "Flushing cache\n");
|
||||
|
||||
_ocf_mngt_begin_flush(cache);
|
||||
@@ -536,6 +542,12 @@ int ocf_mngt_core_flush(ocf_core_t core, bool interruption)
|
||||
return -OCF_ERR_CORE_IN_INACTIVE_STATE;
|
||||
}
|
||||
|
||||
if (!cache->flush_queue) {
|
||||
ocf_core_log(core, log_err,
|
||||
"Cannot flush core - no flush queue set\n");
|
||||
return -OCF_ERR_INVAL;
|
||||
}
|
||||
|
||||
ocf_core_log(core, log_info, "Flushing\n");
|
||||
|
||||
_ocf_mngt_begin_flush(cache);
|
||||
@@ -562,6 +574,12 @@ int ocf_mngt_core_purge(ocf_core_t core, bool interruption)
|
||||
cache = ocf_core_get_cache(core);
|
||||
core_id = ocf_core_get_id(core);
|
||||
|
||||
if (!cache->flush_queue) {
|
||||
ocf_core_log(core, log_err,
|
||||
"Cannot purge core - no flush queue set\n");
|
||||
return -OCF_ERR_INVAL;
|
||||
}
|
||||
|
||||
core_size = ocf_volume_get_length(&cache->core[core_id].volume);
|
||||
core_size = core_size ?: ~0ULL;
|
||||
|
||||
@@ -591,6 +609,12 @@ int ocf_mngt_cache_purge(ocf_cache_t cache, bool interruption)
|
||||
|
||||
OCF_CHECK_NULL(cache);
|
||||
|
||||
if (!cache->flush_queue) {
|
||||
ocf_cache_log(cache, log_err,
|
||||
"Cannot purge cache - no flush queue set\n");
|
||||
return -OCF_ERR_INVAL;
|
||||
}
|
||||
|
||||
_ocf_mngt_begin_flush(cache);
|
||||
|
||||
ocf_cache_log(cache, log_info, "Purging\n");
|
||||
|
Reference in New Issue
Block a user