Merge pull request #145 from robertbaldyga/remove-interruption-arg-flush
Remove "interruption" argument from flush() functions
This commit is contained in:
commit
8d09d7ae47
@ -532,11 +532,10 @@ typedef void (*ocf_mngt_cache_flush_end_t)(ocf_cache_t cache,
|
|||||||
* @brief Flush data from given cache
|
* @brief Flush data from given cache
|
||||||
*
|
*
|
||||||
* @param[in] cache Cache handle
|
* @param[in] cache Cache handle
|
||||||
* @param[in] interruption Allow for interruption
|
|
||||||
* @param[in] cmpl Completion callback
|
* @param[in] cmpl Completion callback
|
||||||
* @param[in] priv Completion callback context
|
* @param[in] priv Completion callback context
|
||||||
*/
|
*/
|
||||||
void ocf_mngt_cache_flush(ocf_cache_t cache, bool interruption,
|
void ocf_mngt_cache_flush(ocf_cache_t cache,
|
||||||
ocf_mngt_cache_flush_end_t cmpl, void *priv);
|
ocf_mngt_cache_flush_end_t cmpl, void *priv);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -553,11 +552,10 @@ typedef void (*ocf_mngt_core_flush_end_t)(ocf_core_t core,
|
|||||||
* @brief Flush data to given core
|
* @brief Flush data to given core
|
||||||
*
|
*
|
||||||
* @param[in] core Core handle
|
* @param[in] core Core handle
|
||||||
* @param[in] interruption Allow for interruption
|
|
||||||
* @param[in] cmpl Completion callback
|
* @param[in] cmpl Completion callback
|
||||||
* @param[in] priv Completion callback context
|
* @param[in] priv Completion callback context
|
||||||
*/
|
*/
|
||||||
void ocf_mngt_core_flush(ocf_core_t core, bool interruption,
|
void ocf_mngt_core_flush(ocf_core_t core,
|
||||||
ocf_mngt_core_flush_end_t cmpl, void *priv);
|
ocf_mngt_core_flush_end_t cmpl, void *priv);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2291,8 +2291,7 @@ static void ocf_mngt_cache_detach_flush(ocf_pipeline_t pipeline,
|
|||||||
struct ocf_mngt_cache_detach_context *context = priv;
|
struct ocf_mngt_cache_detach_context *context = priv;
|
||||||
ocf_cache_t cache = context->cache;
|
ocf_cache_t cache = context->cache;
|
||||||
|
|
||||||
ocf_mngt_cache_flush(cache, true, ocf_mngt_cache_detach_flush_cmpl,
|
ocf_mngt_cache_flush(cache, ocf_mngt_cache_detach_flush_cmpl, context);
|
||||||
context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ocf_mngt_cache_detach_wait_pending(ocf_pipeline_t pipeline,
|
static void ocf_mngt_cache_detach_wait_pending(ocf_pipeline_t pipeline,
|
||||||
|
@ -46,8 +46,6 @@ struct ocf_mngt_cache_flush_context
|
|||||||
ocf_cache_t cache;
|
ocf_cache_t cache;
|
||||||
/* target core */
|
/* target core */
|
||||||
ocf_core_t core;
|
ocf_core_t core;
|
||||||
/* true if flush interrupt respected */
|
|
||||||
bool allow_interruption;
|
|
||||||
|
|
||||||
/* management operation identifier */
|
/* management operation identifier */
|
||||||
enum {
|
enum {
|
||||||
@ -364,18 +362,11 @@ static void _ocf_mngt_flush_portion_end(void *private_data, int error)
|
|||||||
env_atomic_cmpxchg(&fsc->error, 0, error);
|
env_atomic_cmpxchg(&fsc->error, 0, error);
|
||||||
|
|
||||||
if (cache->flushing_interrupted) {
|
if (cache->flushing_interrupted) {
|
||||||
first_interrupt = !env_atomic_cmpxchg(&fsc->interrupt_seen, 0, 1);
|
first_interrupt = !env_atomic_cmpxchg(
|
||||||
|
&fsc->interrupt_seen, 0, 1);
|
||||||
if (first_interrupt) {
|
if (first_interrupt) {
|
||||||
if (context->allow_interruption) {
|
ocf_cache_log(cache, log_info,
|
||||||
ocf_cache_log(cache, log_info,
|
"Flushing interrupted by user\n");
|
||||||
"Flushing interrupted by "
|
|
||||||
"user\n");
|
|
||||||
} else {
|
|
||||||
ocf_cache_log(cache, log_err,
|
|
||||||
"Cannot interrupt flushing\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (context->allow_interruption) {
|
|
||||||
env_atomic_cmpxchg(&fsc->error, 0,
|
env_atomic_cmpxchg(&fsc->error, 0,
|
||||||
-OCF_ERR_FLUSHING_INTERRUPTED);
|
-OCF_ERR_FLUSHING_INTERRUPTED);
|
||||||
}
|
}
|
||||||
@ -598,6 +589,7 @@ static void _ocf_mngt_cache_flush(ocf_pipeline_t pipeline, void *priv,
|
|||||||
ocf_pipeline_arg_t arg)
|
ocf_pipeline_arg_t arg)
|
||||||
{
|
{
|
||||||
struct ocf_mngt_cache_flush_context *context = priv;
|
struct ocf_mngt_cache_flush_context *context = priv;
|
||||||
|
|
||||||
context->cache->flushing_interrupted = 0;
|
context->cache->flushing_interrupted = 0;
|
||||||
_ocf_mngt_flush_all_cores(context, _ocf_mngt_flush_all_cores_complete);
|
_ocf_mngt_flush_all_cores(context, _ocf_mngt_flush_all_cores_complete);
|
||||||
}
|
}
|
||||||
@ -657,7 +649,7 @@ static struct ocf_pipeline_properties _ocf_mngt_cache_flush_pipeline_properties
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
void ocf_mngt_cache_flush(ocf_cache_t cache, bool interruption,
|
void ocf_mngt_cache_flush(ocf_cache_t cache,
|
||||||
ocf_mngt_cache_flush_end_t cmpl, void *priv)
|
ocf_mngt_cache_flush_end_t cmpl, void *priv)
|
||||||
{
|
{
|
||||||
ocf_pipeline_t pipeline;
|
ocf_pipeline_t pipeline;
|
||||||
@ -695,7 +687,6 @@ void ocf_mngt_cache_flush(ocf_cache_t cache, bool interruption,
|
|||||||
context->cmpl.flush_cache = cmpl;
|
context->cmpl.flush_cache = cmpl;
|
||||||
context->priv = priv;
|
context->priv = priv;
|
||||||
context->cache = cache;
|
context->cache = cache;
|
||||||
context->allow_interruption = interruption;
|
|
||||||
context->op = flush_cache;
|
context->op = flush_cache;
|
||||||
|
|
||||||
ocf_pipeline_next(context->pipeline);
|
ocf_pipeline_next(context->pipeline);
|
||||||
@ -744,7 +735,7 @@ struct ocf_pipeline_properties _ocf_mngt_core_flush_pipeline_properties = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
void ocf_mngt_core_flush(ocf_core_t core, bool interruption,
|
void ocf_mngt_core_flush(ocf_core_t core,
|
||||||
ocf_mngt_core_flush_end_t cmpl, void *priv)
|
ocf_mngt_core_flush_end_t cmpl, void *priv)
|
||||||
{
|
{
|
||||||
ocf_pipeline_t pipeline;
|
ocf_pipeline_t pipeline;
|
||||||
@ -785,7 +776,6 @@ void ocf_mngt_core_flush(ocf_core_t core, bool interruption,
|
|||||||
context->cmpl.flush_core = cmpl;
|
context->cmpl.flush_core = cmpl;
|
||||||
context->priv = priv;
|
context->priv = priv;
|
||||||
context->cache = cache;
|
context->cache = cache;
|
||||||
context->allow_interruption = interruption;
|
|
||||||
context->op = flush_core;
|
context->op = flush_core;
|
||||||
context->core = core;
|
context->core = core;
|
||||||
|
|
||||||
@ -845,7 +835,6 @@ void ocf_mngt_cache_purge(ocf_cache_t cache,
|
|||||||
context->cmpl.purge_cache = cmpl;
|
context->cmpl.purge_cache = cmpl;
|
||||||
context->priv = priv;
|
context->priv = priv;
|
||||||
context->cache = cache;
|
context->cache = cache;
|
||||||
context->allow_interruption = true;
|
|
||||||
context->op = purge_cache;
|
context->op = purge_cache;
|
||||||
context->purge.core_id = OCF_CORE_ID_INVALID;
|
context->purge.core_id = OCF_CORE_ID_INVALID;
|
||||||
context->purge.end_byte = ~0ULL;
|
context->purge.end_byte = ~0ULL;
|
||||||
@ -899,7 +888,6 @@ void ocf_mngt_core_purge(ocf_core_t core,
|
|||||||
context->cmpl.purge_core = cmpl;
|
context->cmpl.purge_core = cmpl;
|
||||||
context->priv = priv;
|
context->priv = priv;
|
||||||
context->cache = cache;
|
context->cache = cache;
|
||||||
context->allow_interruption = true;
|
|
||||||
context->op = purge_core;
|
context->op = purge_core;
|
||||||
context->purge.core_id = core_id;
|
context->purge.core_id = core_id;
|
||||||
context->purge.end_byte = core_size ?: ~0ULL;
|
context->purge.end_byte = core_size ?: ~0ULL;
|
||||||
|
@ -505,7 +505,7 @@ class Cache:
|
|||||||
c = OcfCompletion(
|
c = OcfCompletion(
|
||||||
[("cache", c_void_p), ("priv", c_void_p), ("error", c_int)]
|
[("cache", c_void_p), ("priv", c_void_p), ("error", c_int)]
|
||||||
)
|
)
|
||||||
self.owner.lib.ocf_mngt_cache_flush(self.cache_handle, False, c, None)
|
self.owner.lib.ocf_mngt_cache_flush(self.cache_handle, c, None)
|
||||||
c.wait()
|
c.wait()
|
||||||
if c.results["error"]:
|
if c.results["error"]:
|
||||||
self.put_and_write_unlock()
|
self.put_and_write_unlock()
|
||||||
|
Loading…
Reference in New Issue
Block a user