Merge pull request #872 from mmichal10/fix-cleaning-deinit
Fix cleaning deinit
This commit is contained in:
commit
a03cfacd5e
@ -2163,7 +2163,7 @@ static void ocf_mngt_cache_stop_check_dirty(ocf_pipeline_t pipeline,
|
||||
ocf_pipeline_next(context->pipeline);
|
||||
}
|
||||
|
||||
static void _ocf_mngt_cache_stop_remove_cores(ocf_cache_t cache, bool attached)
|
||||
static void _ocf_mngt_cache_stop_remove_cores(ocf_cache_t cache)
|
||||
{
|
||||
ocf_core_t core;
|
||||
ocf_core_id_t core_id;
|
||||
@ -2172,8 +2172,6 @@ static void _ocf_mngt_cache_stop_remove_cores(ocf_cache_t cache, bool attached)
|
||||
/* All exported objects removed, cleaning up rest. */
|
||||
for_each_core(cache, core, core_id) {
|
||||
cache_mngt_core_remove_from_cache(core);
|
||||
if (attached)
|
||||
cache_mngt_core_remove_from_cleaning_pol(core);
|
||||
cache_mngt_core_deinit(core);
|
||||
if (--no == 0)
|
||||
break;
|
||||
@ -2186,7 +2184,7 @@ static void ocf_mngt_cache_stop_remove_cores(ocf_pipeline_t pipeline,
|
||||
struct ocf_mngt_cache_unplug_context *context = priv;
|
||||
ocf_cache_t cache = context->cache;
|
||||
|
||||
_ocf_mngt_cache_stop_remove_cores(cache, true);
|
||||
_ocf_mngt_cache_stop_remove_cores(cache);
|
||||
|
||||
ocf_pipeline_next(pipeline);
|
||||
}
|
||||
@ -3433,7 +3431,7 @@ void ocf_mngt_cache_standby_activate(ocf_cache_t cache,
|
||||
static void ocf_mngt_cache_stop_detached(ocf_cache_t cache,
|
||||
ocf_mngt_cache_stop_end_t cmpl, void *priv)
|
||||
{
|
||||
_ocf_mngt_cache_stop_remove_cores(cache, false);
|
||||
_ocf_mngt_cache_stop_remove_cores(cache);
|
||||
_ocf_mngt_cache_put_io_queues(cache);
|
||||
ocf_mngt_cache_remove(cache->owner, cache);
|
||||
ocf_cache_log(cache, log_info, "Cache %s successfully stopped\n",
|
||||
|
@ -496,6 +496,37 @@ def test_start_stop_noqueue(pyocf_ctx):
|
||||
assert not c.results["error"], "Failed to stop cache: {}".format(c.results["error"])
|
||||
|
||||
|
||||
@pytest.mark.parametrize("cleaning_policy", CleaningPolicy)
|
||||
def test_load_cache_with_four_cores_with_cleaning(pyocf_ctx, cleaning_policy):
|
||||
cache_device = RamVolume(Size.from_MiB(100))
|
||||
core_device_1 = RamVolume(Size.from_MiB(30))
|
||||
core_device_2 = RamVolume(Size.from_MiB(30))
|
||||
core_device_3 = RamVolume(Size.from_MiB(30))
|
||||
core_device_4 = RamVolume(Size.from_MiB(30))
|
||||
|
||||
cache = Cache.start_on_device(cache_device, cache_mode=CacheMode.WB)
|
||||
core_1 = Core.using_device(core_device_1, name="core_1")
|
||||
core_2 = Core.using_device(core_device_2, name="core_2")
|
||||
core_3 = Core.using_device(core_device_3, name="core_3")
|
||||
core_4 = Core.using_device(core_device_4, name="core_4")
|
||||
|
||||
cache.add_core(core_1)
|
||||
cache.add_core(core_2)
|
||||
cache.add_core(core_3)
|
||||
cache.add_core(core_4)
|
||||
|
||||
cache.set_cleaning_policy(cleaning_policy)
|
||||
|
||||
cache.stop()
|
||||
|
||||
cache = Cache.load_from_device(cache_device)
|
||||
|
||||
conf_stats = cache.get_stats()['conf']
|
||||
|
||||
assert conf_stats['core_count'] == 4
|
||||
assert conf_stats['cleaning_policy'] == cleaning_policy
|
||||
|
||||
|
||||
def run_io_and_cache_data_if_possible(cache, vol, mode, cls, cls_no):
|
||||
queue = vol.parent.get_default_queue()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user