Associate core metadata with core object

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Robert Baldyga
2019-05-24 17:56:21 +02:00
parent 8f681e28c5
commit 711de86bff
19 changed files with 334 additions and 385 deletions

View File

@@ -14,7 +14,6 @@
#include "../engine/engine_common.h"
#include "../concurrency/ocf_cache_concurrency.h"
#include "cleaning_priv.h"
#include "../utils/utils_core.h"
#define OCF_ACP_DEBUG 0
@@ -193,20 +192,23 @@ static struct acp_chunk_info *_acp_get_chunk(struct ocf_cache *cache,
static void _acp_remove_cores(struct ocf_cache *cache)
{
int i;
ocf_core_t core;
ocf_core_id_t core_id;
for_each_core(cache, i)
cleaning_policy_acp_remove_core(cache, i);
for_each_core(cache, core, core_id)
cleaning_policy_acp_remove_core(cache, core_id);
}
static int _acp_load_cores(struct ocf_cache *cache)
{
int i;
ocf_core_t core;
ocf_core_id_t core_id;
int err = 0;
for_each_core(cache, i) {
OCF_DEBUG_PARAM(cache, "loading core %i\n", i);
err = cleaning_policy_acp_add_core(cache, i);
for_each_core(cache, core, core_id) {
OCF_DEBUG_PARAM(cache, "loading core %i\n", core_id);
err = cleaning_policy_acp_add_core(cache, core_id);
if (err)
break;
}
@@ -680,7 +682,8 @@ void cleaning_policy_acp_remove_core(ocf_cache_t cache,
int cleaning_policy_acp_add_core(ocf_cache_t cache,
ocf_core_id_t core_id)
{
uint64_t core_size = cache->core_conf_meta[core_id].length;
ocf_core_t core = ocf_cache_get_core(cache, core_id);
uint64_t core_size = core->conf_meta->length;
uint64_t num_chunks = OCF_DIV_ROUND_UP(core_size, ACP_CHUNK_SIZE);
struct acp_context *acp = _acp_get_ctx_from_cache(cache);
int i;

View File

@@ -89,17 +89,15 @@ ocf_cache_t ocf_cleaner_get_cache(ocf_cleaner_t c)
static int _ocf_cleaner_run_check_dirty_inactive(ocf_cache_t cache)
{
int i;
ocf_core_t core;
ocf_core_id_t core_id;
if (!env_bit_test(ocf_cache_state_incomplete, &cache->cache_state))
return 0;
for (i = 0; i < OCF_CORE_MAX; ++i) {
if (!env_bit_test(i, cache->conf_meta->valid_core_bitmap))
continue;
if (cache->core[i].opened && env_atomic_read(&(cache->
core_runtime_meta[i].dirty_clines))) {
for_each_core(cache, core, core_id) {
if (core->opened && env_atomic_read(
&core->runtime_meta->dirty_clines)) {
return 0;
}
}