Move dirty ref counter to cache->refcnt aggregate
Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
This commit is contained in:
parent
555f477248
commit
979f51612f
@ -2361,7 +2361,7 @@ static void ocf_mngt_cache_detach_finish(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_refcnt_unfreeze(&cache->dirty);
|
ocf_refcnt_unfreeze(&cache->refcnt.dirty);
|
||||||
|
|
||||||
if (!error) {
|
if (!error) {
|
||||||
if (!context->cache_write_error) {
|
if (!context->cache_write_error) {
|
||||||
@ -2422,7 +2422,7 @@ void ocf_mngt_cache_detach(ocf_cache_t cache,
|
|||||||
context->cache = cache;
|
context->cache = cache;
|
||||||
|
|
||||||
/* prevent dirty io */
|
/* prevent dirty io */
|
||||||
ocf_refcnt_freeze(&cache->dirty);
|
ocf_refcnt_freeze(&cache->refcnt.dirty);
|
||||||
|
|
||||||
ocf_pipeline_next(pipeline);
|
ocf_pipeline_next(pipeline);
|
||||||
}
|
}
|
||||||
|
@ -94,15 +94,15 @@ static void _ocf_mngt_begin_flush(ocf_pipeline_t pipeline, void *priv,
|
|||||||
* finish */
|
* finish */
|
||||||
env_mutex_lock(&cache->flush_mutex);
|
env_mutex_lock(&cache->flush_mutex);
|
||||||
|
|
||||||
ocf_refcnt_freeze(&cache->dirty);
|
ocf_refcnt_freeze(&cache->refcnt.dirty);
|
||||||
|
|
||||||
ocf_refcnt_register_zero_cb(&cache->dirty,
|
ocf_refcnt_register_zero_cb(&cache->refcnt.dirty,
|
||||||
_ocf_mngt_begin_flush_complete, context);
|
_ocf_mngt_begin_flush_complete, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _ocf_mngt_end_flush(ocf_cache_t cache)
|
static void _ocf_mngt_end_flush(ocf_cache_t cache)
|
||||||
{
|
{
|
||||||
ocf_refcnt_unfreeze(&cache->dirty);
|
ocf_refcnt_unfreeze(&cache->refcnt.dirty);
|
||||||
|
|
||||||
env_mutex_unlock(&cache->flush_mutex);
|
env_mutex_unlock(&cache->flush_mutex);
|
||||||
}
|
}
|
||||||
|
@ -170,11 +170,13 @@ struct ocf_cache {
|
|||||||
|
|
||||||
env_atomic pending_requests;
|
env_atomic pending_requests;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
struct ocf_refcnt dirty;
|
||||||
|
} refcnt;
|
||||||
|
|
||||||
env_atomic pending_cache_requests;
|
env_atomic pending_cache_requests;
|
||||||
env_waitqueue pending_cache_wq;
|
env_waitqueue pending_cache_wq;
|
||||||
|
|
||||||
struct ocf_refcnt dirty;
|
|
||||||
|
|
||||||
uint32_t fallback_pt_error_threshold;
|
uint32_t fallback_pt_error_threshold;
|
||||||
env_atomic fallback_pt_error_counter;
|
env_atomic fallback_pt_error_counter;
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ static inline ocf_core_t ocf_volume_to_core(ocf_volume_t volume)
|
|||||||
static inline int ocf_io_set_dirty(ocf_cache_t cache,
|
static inline int ocf_io_set_dirty(ocf_cache_t cache,
|
||||||
struct ocf_core_io *core_io)
|
struct ocf_core_io *core_io)
|
||||||
{
|
{
|
||||||
core_io->dirty = ocf_refcnt_inc(&cache->dirty);
|
core_io->dirty = ocf_refcnt_inc(&cache->refcnt.dirty);
|
||||||
return core_io->dirty ? 0 : -EBUSY;
|
return core_io->dirty ? 0 : -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,7 +167,7 @@ static inline void dec_counter_if_req_was_dirty(struct ocf_core_io *core_io,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
core_io->dirty = 0;
|
core_io->dirty = 0;
|
||||||
ocf_refcnt_dec(&cache->dirty);
|
ocf_refcnt_dec(&cache->refcnt.dirty);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int ocf_core_validate_io(struct ocf_io *io)
|
static inline int ocf_core_validate_io(struct ocf_io *io)
|
||||||
|
Loading…
Reference in New Issue
Block a user