Unify core naming convention (core_obj -> core)

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Robert Baldyga 2018-12-12 14:49:17 +01:00
parent db92083432
commit 69947bb44b
30 changed files with 118 additions and 118 deletions

View File

@ -303,7 +303,7 @@ int cleaning_policy_acp_initialize(struct ocf_cache *cache,
ACP_BUCKET_DEFAULTS[i]) / 100;
}
if (cache->conf_meta->core_obj_count > 0) {
if (cache->conf_meta->core_count > 0) {
err = _acp_load_cores(cache);
if (err) {
cleaning_policy_acp_deinitialize(cache);
@ -404,7 +404,7 @@ static void _acp_handle_flush_error(struct ocf_cache *cache,
env_secs_to_ticks(ACP_CHUNK_CLEANING_BACKOFF_TIME);
if (ocf_cache_log_rl(cache)) {
ocf_core_log(&cache->core_obj[flush->chunk->core_id],
ocf_core_log(&cache->core[flush->chunk->core_id],
log_err, "Cleaning error (%d) in range"
" <%llu; %llu) backing off for %u seconds\n",
flush->error,
@ -454,7 +454,7 @@ static inline bool _acp_can_clean_chunk(struct ocf_cache *cache,
{
/* Check if core device is opened and if timeout after cleaning error
* expired or wasn't set in the first place */
return (cache->core_obj[chunk->core_id].opened &&
return (cache->core[chunk->core_id].opened &&
(chunk->next_cleaning_timestamp > env_get_tick_count() ||
!chunk->next_cleaning_timestamp));
}

View File

@ -643,7 +643,7 @@ static int block_is_busy(struct ocf_cache *cache,
ocf_metadata_get_core_info(cache, cache_line,
&core_id, &core_line);
if (!cache->core_obj[core_id].opened)
if (!cache->core[core_id].opened)
return true;
if (ocf_cache_line_is_used(cache, cache_line))

View File

@ -86,7 +86,7 @@ static int _ocf_cleaner_run_check_dirty_inactive(struct ocf_cache *cache)
if (!env_bit_test(i, cache->conf_meta->valid_object_bitmap))
continue;
if (cache->core_obj[i].opened && env_atomic_read(&(cache->
if (cache->core[i].opened && env_atomic_read(&(cache->
core_runtime_meta[i].dirty_clines))) {
return 0;
}

View File

@ -59,7 +59,7 @@ static void _ocf_backfill_do_io(struct ocf_request *req, int error)
req->data = NULL;
if (req->error) {
env_atomic_inc(&cache->core_obj[req->core_id].
env_atomic_inc(&cache->core[req->core_id].
counters->cache_errors.write);
ocf_engine_invalidate(req);
} else {

View File

@ -24,7 +24,7 @@ void ocf_engine_error(struct ocf_request *req,
if (stop_cache)
env_bit_clear(ocf_cache_state_running, &cache->cache_state);
ocf_core_log(&cache->core_obj[req->core_id], log_err,
ocf_core_log(&cache->core[req->core_id], log_err,
"%s sector: %" ENV_PRIu64 ", bytes: %u\n", msg,
BYTES_TO_SECTORS(req->byte_position), req->byte_length);
}
@ -446,7 +446,7 @@ void ocf_engine_update_block_stats(struct ocf_request *req)
ocf_part_id_t part_id = req->part_id;
struct ocf_counters_block *blocks;
blocks = &cache->core_obj[core_id].counters->
blocks = &cache->core[core_id].counters->
part_counters[part_id].blocks;
if (req->rw == OCF_READ)
@ -466,11 +466,11 @@ void ocf_engine_update_request_stats(struct ocf_request *req)
switch (req->rw) {
case OCF_READ:
reqs = &cache->core_obj[core_id].counters->
reqs = &cache->core[core_id].counters->
part_counters[part_id].read_reqs;
break;
case OCF_WRITE:
reqs = &cache->core_obj[core_id].counters->
reqs = &cache->core[core_id].counters->
part_counters[part_id].write_reqs;
break;
default:

View File

@ -16,7 +16,7 @@
static void _ocf_d2c_completion(struct ocf_request *req, int error)
{
ocf_core_t core = &req->cache->core_obj[req->core_id];
ocf_core_t core = &req->cache->core[req->core_id];
req->error = error;
OCF_DEBUG_RQ(req, "Completion");
@ -39,7 +39,7 @@ static void _ocf_d2c_completion(struct ocf_request *req, int error)
int ocf_io_d2c(struct ocf_request *req)
{
ocf_cache_t cache = req->cache;
ocf_core_t core = &cache->core_obj[req->core_id];
ocf_core_t core = &cache->core[req->core_id];
OCF_DEBUG_TRACE(req->cache);

View File

@ -63,7 +63,7 @@ static int _ocf_discard_core(struct ocf_request *req)
struct ocf_cache *cache = req->cache;
struct ocf_io *io;
io = ocf_dobj_new_io(&cache->core_obj[req->core_id].obj);
io = ocf_dobj_new_io(&cache->core[req->core_id].obj);
if (!io) {
_ocf_discard_complete_req(req, -ENOMEM);
return -ENOMEM;

View File

@ -43,7 +43,7 @@ static void _ocf_read_fast_io(struct ocf_request *req, int error)
if (req->error) {
OCF_DEBUG_RQ(req, "ERROR");
env_atomic_inc(&req->cache->core_obj[req->core_id].counters->
env_atomic_inc(&req->cache->core[req->core_id].counters->
cache_errors.read);
ocf_engine_push_req_front_pt(req);
} else {

View File

@ -20,7 +20,7 @@ static void _ocf_invalidate_req(struct ocf_request *req, int error)
{
if (error) {
req->error = error;
env_atomic_inc(&req->cache->core_obj[req->core_id].counters->
env_atomic_inc(&req->cache->core[req->core_id].counters->
cache_errors.write);
}

View File

@ -48,7 +48,7 @@ int ocf_engine_ops(struct ocf_request *req)
env_atomic_set(&req->req_remaining, 2);
/* Submit operation into core device */
ocf_submit_obj_req(&cache->core_obj[req->core_id].obj, req,
ocf_submit_obj_req(&cache->core[req->core_id].obj, req,
_ocf_engine_ops_io);
ocf_submit_cache_reqs(cache, req->map, req, req->rw,

View File

@ -28,7 +28,7 @@ static void _ocf_read_pt_io(struct ocf_request *req, int error)
if (req->error) {
req->info.core_error = 1;
env_atomic_inc(&req->cache->core_obj[req->core_id].counters->
env_atomic_inc(&req->cache->core[req->core_id].counters->
core_errors.read);
}
@ -50,7 +50,7 @@ static inline void _ocf_read_pt_submit(struct ocf_request *req)
OCF_DEBUG_RQ(req, "Submit");
/* Core read */
ocf_submit_obj_req(&cache->core_obj[req->core_id].obj, req,
ocf_submit_obj_req(&cache->core[req->core_id].obj, req,
_ocf_read_pt_io);
}
@ -91,7 +91,7 @@ int ocf_read_pt_do(struct ocf_request *req)
/* Update statistics */
ocf_engine_update_block_stats(req);
env_atomic64_inc(&cache->core_obj[req->core_id].counters->
env_atomic64_inc(&cache->core[req->core_id].counters->
part_counters[req->part_id].read_reqs.pass_through);
/* Put OCF request - decrease reference counter */

View File

@ -38,7 +38,7 @@ static void _ocf_read_generic_hit_io(struct ocf_request *req, int error)
OCF_DEBUG_RQ(req, "HIT completion");
if (req->error) {
env_atomic_inc(&req->cache->core_obj[req->core_id].
env_atomic_inc(&req->cache->core[req->core_id].
counters->cache_errors.read);
ocf_engine_push_req_front_pt(req);
} else {
@ -78,7 +78,7 @@ static void _ocf_read_generic_miss_io(struct ocf_request *req, int error)
req->complete(req, req->error);
req->info.core_error = 1;
env_atomic_inc(&cache->core_obj[req->core_id].
env_atomic_inc(&cache->core[req->core_id].
counters->core_errors.read);
ctx_data_free(cache->owner, req->cp_data);
@ -128,7 +128,7 @@ static inline void _ocf_read_generic_submit_miss(struct ocf_request *req)
goto err_alloc;
/* Submit read request to core device. */
ocf_submit_obj_req(&cache->core_obj[req->core_id].obj, req,
ocf_submit_obj_req(&cache->core[req->core_id].obj, req,
_ocf_read_generic_miss_io);
return;

View File

@ -24,7 +24,7 @@ static void _ocf_read_wa_io(struct ocf_request *req, int error)
if (req->error) {
req->info.core_error = 1;
env_atomic_inc(&req->cache->core_obj[req->core_id].counters->
env_atomic_inc(&req->cache->core[req->core_id].counters->
core_errors.write);
}
@ -72,12 +72,12 @@ int ocf_write_wa(struct ocf_request *req)
/* Submit write IO to the core */
env_atomic_set(&req->req_remaining, 1);
ocf_submit_obj_req(&cache->core_obj[req->core_id].obj, req,
ocf_submit_obj_req(&cache->core[req->core_id].obj, req,
_ocf_read_wa_io);
/* Update statistics */
ocf_engine_update_block_stats(req);
env_atomic64_inc(&cache->core_obj[req->core_id].counters->
env_atomic64_inc(&cache->core[req->core_id].counters->
part_counters[req->part_id].write_reqs.pass_through);
}

View File

@ -88,7 +88,7 @@ static const struct ocf_io_if _io_if_wb_flush_metadata = {
static void _ocf_write_wb_io(struct ocf_request *req, int error)
{
if (error) {
env_atomic_inc(&req->cache->core_obj[req->core_id].counters->
env_atomic_inc(&req->cache->core[req->core_id].counters->
cache_errors.write);
req->error |= error;
}

View File

@ -26,7 +26,7 @@ static const struct ocf_io_if _io_if_wi_flush_metadata = {
static void _ocf_write_wi_io_flush_metadata(struct ocf_request *req, int error)
{
if (error) {
env_atomic_inc(&req->cache->core_obj[req->core_id].counters->
env_atomic_inc(&req->cache->core[req->core_id].counters->
cache_errors.write);
req->error |= error;
}
@ -78,7 +78,7 @@ static void _ocf_write_wi_core_io(struct ocf_request *req, int error)
if (error) {
req->error = error;
req->info.core_error = 1;
env_atomic_inc(&req->cache->core_obj[req->core_id].counters->
env_atomic_inc(&req->cache->core[req->core_id].counters->
core_errors.write);
}
@ -111,12 +111,12 @@ static int _ocf_write_wi_do(struct ocf_request *req)
OCF_DEBUG_RQ(req, "Submit");
/* Submit write IO to the core */
ocf_submit_obj_req(&cache->core_obj[req->core_id].obj, req,
ocf_submit_obj_req(&cache->core[req->core_id].obj, req,
_ocf_write_wi_core_io);
/* Update statistics */
ocf_engine_update_block_stats(req);
env_atomic64_inc(&cache->core_obj[req->core_id].counters->
env_atomic64_inc(&cache->core[req->core_id].counters->
part_counters[req->part_id].write_reqs.pass_through);
/* Put OCF request - decrease reference counter */

View File

@ -48,7 +48,7 @@ static void _ocf_write_wt_cache_io(struct ocf_request *req, int error)
{
if (error) {
req->error = req->error ?: error;
env_atomic_inc(&req->cache->core_obj[req->core_id].counters->
env_atomic_inc(&req->cache->core[req->core_id].counters->
cache_errors.write);
if (req->error)
@ -63,7 +63,7 @@ static void _ocf_write_wt_core_io(struct ocf_request *req, int error)
if (error) {
req->error = error;
req->info.core_error = 1;
env_atomic_inc(&req->cache->core_obj[req->core_id].counters->
env_atomic_inc(&req->cache->core[req->core_id].counters->
core_errors.write);
}
@ -93,7 +93,7 @@ static inline void _ocf_write_wt_submit(struct ocf_request *req)
ocf_engine_io_count(req), _ocf_write_wt_cache_io);
/* To core */
ocf_submit_obj_req(&cache->core_obj[req->core_id].obj, req,
ocf_submit_obj_req(&cache->core[req->core_id].obj, req,
_ocf_write_wt_core_io);
}

View File

@ -50,7 +50,7 @@ static const struct ocf_io_if _io_if_zero_purge = {
static void _ocf_zero_io_flush_metadata(struct ocf_request *req, int error)
{
if (error) {
env_atomic_inc(&req->cache->core_obj[req->core_id].counters->
env_atomic_inc(&req->cache->core[req->core_id].counters->
cache_errors.write);
req->error = error;
}

View File

@ -975,7 +975,7 @@ static int ocf_metadata_hash_load_superblock(struct ocf_cache *cache)
uuid.size = muuid->size;
/* Initialize core data object */
ocf_data_obj_init(&cache->core_obj[i].obj,
ocf_data_obj_init(&cache->core[i].obj,
ocf_ctx_get_data_obj_type(cache->owner,
cache->core_conf_meta[i].type),
&uuid, false);
@ -983,7 +983,7 @@ static int ocf_metadata_hash_load_superblock(struct ocf_cache *cache)
/* Restore all dynamics items */
if (sb_config->core_obj_count > OCF_CORE_MAX) {
if (sb_config->core_count > OCF_CORE_MAX) {
ocf_cache_log(cache, log_err,
"Loading cache state ERROR, invalid cores count\n");
goto ocf_metadata_hash_load_superblock_ERROR;
@ -1024,7 +1024,7 @@ static int ocf_metadata_hash_flush_superblock(struct ocf_cache *cache)
/* Synchronize core objects types */
for (i = 0; i < OCF_CORE_MAX; i++) {
cache->core_conf_meta[i].type = ocf_ctx_get_data_obj_type_id(
cache->owner, cache->core_obj[i].obj.type);
cache->owner, cache->core[i].obj.type);
}
/* Calculate checksum */

View File

@ -29,7 +29,7 @@ struct ocf_superblock_config {
ocf_cache_line_size_t line_size;
ocf_metadata_layout_t metadata_layout;
uint32_t core_obj_count;
uint32_t core_count;
unsigned long valid_object_bitmap[(OCF_CORE_MAX /
(sizeof(unsigned long) * 8)) + 1];

View File

@ -273,7 +273,7 @@ static void __init_eviction_policy(struct ocf_cache *cache,
static void __init_cores(struct ocf_cache *cache)
{
/* No core devices yet */
cache->conf_meta->core_obj_count = 0;
cache->conf_meta->core_count = 0;
ENV_BUG_ON(env_memset(cache->conf_meta->valid_object_bitmap,
sizeof(cache->conf_meta->valid_object_bitmap), 0));
}
@ -359,22 +359,22 @@ static void _ocf_mngt_close_all_uninitialized_cores(
ocf_data_obj_t obj;
int j, i;
for (j = cache->conf_meta->core_obj_count, i = 0; j > 0; ++i) {
for (j = cache->conf_meta->core_count, i = 0; j > 0; ++i) {
if (!env_bit_test(i, cache->conf_meta->valid_object_bitmap))
continue;
obj = &(cache->core_obj[i].obj);
obj = &(cache->core[i].obj);
ocf_data_obj_close(obj);
--j;
env_free(cache->core_obj[i].counters);
cache->core_obj[i].counters = NULL;
env_free(cache->core[i].counters);
cache->core[i].counters = NULL;
env_bit_clear(i, cache->conf_meta->valid_object_bitmap);
}
cache->conf_meta->core_obj_count = 0;
cache->conf_meta->core_count = 0;
}
/**
@ -407,17 +407,17 @@ static int _ocf_mngt_init_instance_add_cores(
}
/* Count value will be re-calculated on the basis of 'added' flag */
cache->conf_meta->core_obj_count = 0;
cache->conf_meta->core_count = 0;
/* Check in metadata which cores were added into cache */
for (i = 0; i < OCF_CORE_MAX; i++) {
ocf_data_obj_t tobj = NULL;
ocf_core_t core = &cache->core_obj[i];
ocf_core_t core = &cache->core[i];
if (!cache->core_conf_meta[i].added)
continue;
if (!cache->core_obj[i].obj.type)
if (!cache->core[i].obj.type)
goto _cache_mng_init_instance_add_cores_ERROR;
ret = snprintf(core_name, sizeof(core_name), "%d", i);
@ -458,7 +458,7 @@ static int _ocf_mngt_init_instance_add_cores(
}
env_bit_set(i, cache->conf_meta->valid_object_bitmap);
cache->conf_meta->core_obj_count++;
cache->conf_meta->core_count++;
core->obj.cache = cache;
core->counters =
@ -478,7 +478,7 @@ static int _ocf_mngt_init_instance_add_cores(
hd_lines = ocf_bytes_2_lines(cache,
ocf_data_obj_get_length(
&cache->core_obj[i].obj));
&cache->core[i].obj));
if (hd_lines) {
ocf_cache_log(cache, log_info,
@ -1265,7 +1265,7 @@ static int _ocf_mngt_cache_add_cores_t_clean_pol(ocf_cache_t cache)
int result;
if (cleaning_policy_ops[clean_type].add_core) {
no = cache->conf_meta->core_obj_count;
no = cache->conf_meta->core_count;
for (i = 0, j = 0; j < no && i < OCF_CORE_MAX; i++) {
if (!env_bit_test(i, cache->conf_meta->valid_object_bitmap))
continue;
@ -1537,7 +1537,7 @@ static int _ocf_mngt_cache_unplug(ocf_cache_t cache, bool stop)
int result;
if (stop)
ENV_BUG_ON(cache->conf_meta->core_obj_count != 0);
ENV_BUG_ON(cache->conf_meta->core_count != 0);
ocf_stop_cleaner(cache);
@ -1590,7 +1590,7 @@ static int _ocf_mngt_cache_stop(ocf_cache_t cache)
int i, j, no, result = 0;
ocf_ctx_t owner = cache->owner;
no = cache->conf_meta->core_obj_count;
no = cache->conf_meta->core_count;
env_bit_set(ocf_cache_state_stopping, &cache->cache_state);
env_bit_clear(ocf_cache_state_running, &cache->cache_state);
@ -1607,7 +1607,7 @@ static int _ocf_mngt_cache_stop(ocf_cache_t cache)
cache_mng_core_close(cache, i);
j++;
}
ENV_BUG_ON(cache->conf_meta->core_obj_count != 0);
ENV_BUG_ON(cache->conf_meta->core_count != 0);
if (env_atomic_read(&cache->attached))
result = _ocf_mngt_cache_unplug(cache, true);
@ -2062,7 +2062,7 @@ int ocf_mngt_cache_detach(ocf_cache_t cache)
int result;
ocf_cache_mode_t mode;
no = cache->conf_meta->core_obj_count;
no = cache->conf_meta->core_count;
result = ocf_mngt_cache_lock(cache);
if (result)

View File

@ -19,11 +19,11 @@
/* Close if opened */
int cache_mng_core_close(ocf_cache_t cache, ocf_core_id_t core_id)
{
if (!cache->core_obj[core_id].opened)
if (!cache->core[core_id].opened)
return -OCF_ERR_CORE_IN_INACTIVE_STATE;
ocf_data_obj_close(&cache->core_obj[core_id].obj);
cache->core_obj[core_id].opened = false;
ocf_data_obj_close(&cache->core[core_id].obj);
cache->core[core_id].opened = false;
return 0;
}
@ -37,7 +37,7 @@ void cache_mng_core_remove_from_cleaning_pol(struct ocf_cache *cache,
OCF_METADATA_LOCK_WR();
clean_pol_type = cache->conf_meta->cleaning_policy_type;
if (cache->core_obj[core_id].opened) {
if (cache->core[core_id].opened) {
if (cleaning_policy_ops[clean_pol_type].remove_core) {
cleaning_policy_ops[clean_pol_type].
remove_core(cache, core_id);
@ -55,7 +55,7 @@ void cache_mng_core_deinit_attached_meta(struct ocf_cache *cache, int core_id)
ocf_cleaning_t clean_pol_type;
ocf_data_obj_t core;
core = &cache->core_obj[core_id].obj;
core = &cache->core[core_id].obj;
core_size = ocf_data_obj_get_length(core);
if (!core_size)
@ -96,7 +96,7 @@ void cache_mng_core_remove_from_meta(struct ocf_cache *cache, int core_id)
cache->core_conf_meta[core_id].added = false;
/* Clear UUID of core */
ocf_uuid_core_clear(cache, &cache->core_obj[core_id]);
ocf_uuid_core_clear(cache, &cache->core[core_id]);
cache->core_conf_meta[core_id].seq_no = OCF_SEQ_NO_INVALID;
OCF_METADATA_UNLOCK_WR();
@ -105,16 +105,16 @@ void cache_mng_core_remove_from_meta(struct ocf_cache *cache, int core_id)
/* Deinit in-memory structures related to this core */
void cache_mng_core_remove_from_cache(struct ocf_cache *cache, int core_id)
{
env_free(cache->core_obj[core_id].counters);
cache->core_obj[core_id].counters = NULL;
env_free(cache->core[core_id].counters);
cache->core[core_id].counters = NULL;
env_bit_clear(core_id, cache->conf_meta->valid_object_bitmap);
if (!cache->core_obj[core_id].opened &&
if (!cache->core[core_id].opened &&
--cache->ocf_core_inactive_count == 0) {
env_bit_clear(ocf_cache_state_incomplete, &cache->cache_state);
}
cache->conf_meta->core_obj_count--;
cache->conf_meta->core_count--;
}
/**

View File

@ -24,11 +24,11 @@ static int _ocf_mngt_cache_try_add_core(ocf_cache_t cache, ocf_core_t *core,
struct ocf_mngt_core_config *cfg)
{
int result = 0;
struct ocf_core *core_obj;
ocf_core_t tmp_core;
ocf_data_obj_t obj;
core_obj = &cache->core_obj[cfg->core_id];
obj = &core_obj->obj;
tmp_core = &cache->core[cfg->core_id];
obj = &tmp_core->obj;
if (ocf_ctx_get_data_obj_type_id(cache->owner, obj->type) !=
cfg->data_obj_type) {
@ -45,12 +45,12 @@ static int _ocf_mngt_cache_try_add_core(ocf_cache_t cache, ocf_core_t *core,
goto error_after_open;
}
cache->core_obj[cfg->core_id].opened = true;
tmp_core->opened = true;
if (!(--cache->ocf_core_inactive_count))
env_bit_clear(ocf_cache_state_incomplete, &cache->cache_state);
*core = core_obj;
*core = tmp_core;
return 0;
error_after_open:
@ -64,19 +64,19 @@ static int _ocf_mngt_cache_add_core(ocf_cache_t cache, ocf_core_t *core,
struct ocf_mngt_core_config *cfg)
{
int result = 0;
struct ocf_core *core_obj;
ocf_core_t tmp_core;
ocf_data_obj_t obj;
ocf_seq_no_t core_sequence_no;
ocf_cleaning_t clean_type;
uint64_t length;
core_obj = &cache->core_obj[cfg->core_id];
obj = &core_obj->obj;
tmp_core = &cache->core[cfg->core_id];
obj = &tmp_core->obj;
core_obj->obj.cache = cache;
tmp_core->obj.cache = cache;
/* Set uuid */
ocf_uuid_core_set(cache, core_obj, &cfg->uuid);
ocf_uuid_core_set(cache, tmp_core, &cfg->uuid);
obj->type = ocf_ctx_get_data_obj_type(cache->owner, cfg->data_obj_type);
if (!obj->type) {
@ -85,7 +85,7 @@ static int _ocf_mngt_cache_add_core(ocf_cache_t cache, ocf_core_t *core,
}
if (cfg->user_metadata.data && cfg->user_metadata.size > 0) {
result = ocf_core_set_user_metadata_raw(core_obj,
result = ocf_core_set_user_metadata_raw(tmp_core,
cfg->user_metadata.data,
cfg->user_metadata.size);
if (result)
@ -113,14 +113,14 @@ static int _ocf_mngt_cache_add_core(ocf_cache_t cache, ocf_core_t *core,
}
/* When adding new core to cache, allocate stat counters */
core_obj->counters =
env_zalloc(sizeof(*core_obj->counters), ENV_MEM_NORMAL);
if (!core_obj->counters) {
tmp_core->counters =
env_zalloc(sizeof(*tmp_core->counters), ENV_MEM_NORMAL);
if (!tmp_core->counters) {
result = -OCF_ERR_NO_MEM;
goto error_after_clean_pol;
}
/* When adding new core to cache, reset all core/cache statistics */
ocf_stats_init(core_obj);
ocf_stats_init(tmp_core);
env_atomic_set(&cache->core_runtime_meta[cfg->core_id].
cached_clines, 0);
env_atomic_set(&cache->core_runtime_meta[cfg->core_id].
@ -131,7 +131,7 @@ static int _ocf_mngt_cache_add_core(ocf_cache_t cache, ocf_core_t *core,
/* In metadata mark data this core was added into cache */
env_bit_set(cfg->core_id, cache->conf_meta->valid_object_bitmap);
cache->core_conf_meta[cfg->core_id].added = true;
cache->core_obj[cfg->core_id].opened = true;
tmp_core->opened = true;
/* Set default cache parameters for sequential */
cache->core_conf_meta[cfg->core_id].seq_cutoff_policy =
@ -154,15 +154,15 @@ static int _ocf_mngt_cache_add_core(ocf_cache_t cache, ocf_core_t *core,
}
/* Increase value of added cores */
cache->conf_meta->core_obj_count++;
cache->conf_meta->core_count++;
*core = core_obj;
*core = tmp_core;
return 0;
error_after_counters_allocation:
env_bit_clear(cfg->core_id, cache->conf_meta->valid_object_bitmap);
cache->core_conf_meta[cfg->core_id].added = false;
cache->core_obj[cfg->core_id].opened = false;
tmp_core->opened = false;
/* An error when flushing metadata, try restore for safety reason
* previous metadata sate on cache device.
@ -173,8 +173,8 @@ error_after_counters_allocation:
*/
ocf_metadata_flush_superblock(cache);
env_free(core_obj->counters);
core_obj->counters = NULL;
env_free(tmp_core->counters);
tmp_core->counters = NULL;
error_after_clean_pol:
if (cleaning_policy_ops[clean_type].remove_core)
@ -183,7 +183,7 @@ error_after_clean_pol:
error_after_open:
ocf_data_obj_close(obj);
error_out:
ocf_uuid_core_clear(cache, core_obj);
ocf_uuid_core_clear(cache, tmp_core);
*core = NULL;
return result;
}
@ -228,12 +228,12 @@ static int __ocf_mngt_lookup_core_uuid(ocf_cache_t cache,
int i;
for (i = 0; i < OCF_CORE_MAX; i++) {
ocf_core_t core = &cache->core_obj[i];
ocf_core_t core = &cache->core[i];
if (!env_bit_test(i, cache->conf_meta->valid_object_bitmap))
continue;
if (cache->core_obj[i].opened)
if (cache->core[i].opened)
continue;
if (ocf_ctx_get_data_obj_type_id(cache->owner, core->obj.type)
@ -291,7 +291,7 @@ static int __ocf_mngt_find_core_id(ocf_cache_t cache,
OCF_CORE_MAX);
/* no need to check if find_first_zero_bit failed and
* *core_id == MAX_CORE_OBJS_PER_CACHE, as above there is check
* for core_obj_count being greater or equal to
* for core_count being greater or equal to
* MAX_CORE_OBJS_PER_CACHE
*/
} else if (cfg->core_id < OCF_CORE_MAX) {
@ -319,7 +319,7 @@ static int _ocf_mngt_find_core_id(ocf_cache_t cache,
int result;
ocf_core_id_t tmp_core_id;
if (cache->conf_meta->core_obj_count >= OCF_CORE_MAX)
if (cache->conf_meta->core_count >= OCF_CORE_MAX)
return -OCF_ERR_TOO_MANY_CORES;
tmp_core_id = __ocf_mngt_lookup_core_uuid(cache, cfg);
@ -357,7 +357,7 @@ int ocf_mngt_cache_add_core_nolock(ocf_cache_t cache, ocf_core_t *core,
return result;
}
result = ocf_core_set_name(&cache->core_obj[cfg->core_id], core_name,
result = ocf_core_set_name(&cache->core[cfg->core_id], core_name,
sizeof(core_name));
if (result)
return result;

View File

@ -102,13 +102,13 @@ static int _ocf_mngt_get_sectors(struct ocf_cache *cache, int core_id,
break;
}
ocf_core_log(&cache->core_obj[core_id], log_debug,
ocf_core_log(&cache->core[core_id], log_debug,
"%u dirty cache lines to clean\n", j);
if (dirty != j) {
ocf_cache_log(cache, log_debug, "Wrong number of dirty "
"blocks for flushing core %s (%u!=%u)\n",
cache->core_obj[core_id].name, j, dirty);
cache->core[core_id].name, j, dirty);
}
@ -139,7 +139,7 @@ static int _ocf_mngt_get_flush_containers(ocf_cache_t cache,
* each core. Cores can be partitions of single device.
*/
num = cache->conf_meta->core_obj_count;
num = cache->conf_meta->core_count;
if (num == 0) {
*fcnum = 0;
return 0;
@ -173,7 +173,7 @@ static int _ocf_mngt_get_flush_containers(ocf_cache_t cache,
sizeof(*fc[j].flush_data));
}
if (++j == cache->conf_meta->core_obj_count)
if (++j == cache->conf_meta->core_count)
break;
}
@ -334,7 +334,7 @@ static int _ocf_mngt_flush_containers(ocf_cache_t cache,
if (!env_atomic_read(&fctbl[i].completed))
continue;
core = &cache->core_obj[fctbl[i].core_id];
core = &cache->core[fctbl[i].core_id];
env_atomic_set(&core->flushed, fctbl[i].iter);
env_atomic_set(&fctbl[i].completed, 0);
@ -451,9 +451,9 @@ static int _ocf_mng_cache_flush_nolock(ocf_cache_t cache, bool interruption)
if (!env_bit_test(i, cache->conf_meta->valid_object_bitmap))
continue;
env_atomic_set(&cache->core_obj[i].flushed, 0);
env_atomic_set(&cache->core[i].flushed, 0);
if (++j == cache->conf_meta->core_obj_count)
if (++j == cache->conf_meta->core_count)
break;
}
@ -598,7 +598,7 @@ int ocf_mngt_core_purge(ocf_cache_t cache, ocf_core_id_t core_id, bool interrupt
return -OCF_ERR_CORE_NOT_AVAIL;
}
core_size = ocf_data_obj_get_length(&cache->core_obj[core_id].obj);
core_size = ocf_data_obj_get_length(&cache->core[core_id].obj);
core_size = core_size ?: ~0ULL;
_ocf_mngt_begin_flush(cache);

View File

@ -96,7 +96,7 @@ int ocf_cache_get_info(ocf_cache_t cache, struct ocf_cache_info *info)
cache->device->obj.type);
info->size = cache->conf_meta->cachelines;
}
info->core_count = cache->conf_meta->core_obj_count;
info->core_count = cache->conf_meta->core_count;
info->cache_mode = ocf_cache_get_mode(cache);
@ -130,7 +130,7 @@ int ocf_cache_get_info(ocf_cache_t cache, struct ocf_cache_info *info)
initial_dirty_blocks_total += env_atomic_read(&(cache->
core_runtime_meta[i].initial_dirty_clines));
if (!cache->core_obj[i].opened) {
if (!cache->core[i].opened) {
cache_occupancy_inactive += env_atomic_read(&cache->
core_runtime_meta[i].cached_clines);
@ -146,7 +146,7 @@ int ocf_cache_get_info(ocf_cache_t cache, struct ocf_cache_info *info)
}
flushed_total += env_atomic_read(
&cache->core_obj[i].flushed);
&cache->core[i].flushed);
}
info->dirty = dirty_blocks_total;
@ -209,7 +209,7 @@ uint64_t ocf_cache_bytes_2_lines(ocf_cache_t cache, uint64_t bytes)
uint32_t ocf_cache_get_core_count(ocf_cache_t cache)
{
OCF_CHECK_NULL(cache);
return cache->conf_meta->core_obj_count;
return cache->conf_meta->core_count;
}
ocf_ctx_t ocf_cache_get_ctx(ocf_cache_t cache)

View File

@ -175,7 +175,7 @@ struct ocf_cache {
uint32_t io_queues_no;
uint16_t ocf_core_inactive_count;
struct ocf_core core_obj[OCF_CORE_MAX];
struct ocf_core core[OCF_CORE_MAX];
struct ocf_core_meta_config *core_conf_meta;
struct ocf_core_meta_runtime *core_runtime_meta;

View File

@ -34,7 +34,7 @@ ocf_core_id_t ocf_core_get_id(ocf_core_t core)
OCF_CHECK_NULL(core);
cache = core->obj.cache;
core_id = core - cache->core_obj;
core_id = core - cache->core;
return core_id;
}
@ -82,7 +82,7 @@ int ocf_core_get(ocf_cache_t cache, ocf_core_id_t id, ocf_core_t *core)
if (!ocf_core_is_valid(cache, id))
return -OCF_ERR_CORE_NOT_AVAIL;
*core = &cache->core_obj[id];
*core = &cache->core[id];
return 0;
}
@ -639,10 +639,10 @@ int ocf_core_visit(ocf_cache_t cache, ocf_core_visitor_t visitor, void *cntx,
if (!env_bit_test(id, cache->conf_meta->valid_object_bitmap))
continue;
if (only_opened && !cache->core_obj[id].opened)
if (only_opened && !cache->core[id].opened)
continue;
result = visitor(&cache->core_obj[id], cntx);
result = visitor(&cache->core[id], cntx);
if (result)
break;
}

View File

@ -111,7 +111,7 @@ int ocf_stats_initialize(ocf_cache_t cache, ocf_core_id_t core_id)
if (!env_bit_test(id, cache->conf_meta->valid_object_bitmap))
continue;
ocf_stats_init(&cache->core_obj[id]);
ocf_stats_init(&cache->core[id]);
}
ocf_mngt_cache_unlock(cache);
@ -276,7 +276,7 @@ int ocf_core_get_stats(ocf_core_t core, struct ocf_stats_core *stats)
ENV_BUG_ON(env_memset(stats, sizeof(*stats), 0));
stats->core_size_bytes = ocf_data_obj_get_length(
&cache->core_obj[core_id].obj);
&cache->core[core_id].obj);
stats->core_size = ocf_bytes_2_lines_round_up(cache,
stats->core_size_bytes);
stats->seq_cutoff_threshold = ocf_core_get_seq_cutoff_threshold(core);

View File

@ -467,7 +467,7 @@ static void _ocf_cleaner_core_io_cmpl(struct ocf_io *io, int error)
if (error) {
map->invalid |= 1;
_ocf_cleaner_set_error(req);
env_atomic_inc(&req->cache->core_obj[map->core_id].counters->
env_atomic_inc(&req->cache->core[map->core_id].counters->
core_errors.write);
}
@ -484,7 +484,7 @@ static void _ocf_cleaner_core_io_for_dirty_range(struct ocf_request *req,
struct ocf_cache *cache = req->cache;
struct ocf_io *io;
struct ocf_counters_block *core_stats =
&cache->core_obj[iter->core_id].counters->core_blocks;
&cache->core[iter->core_id].counters->core_blocks;
ocf_part_id_t part_id = ocf_metadata_get_partition_id(cache,
iter->coll_idx);
@ -624,7 +624,7 @@ static void _ocf_cleaner_cache_io_cmpl(struct ocf_io *io, int error)
if (error) {
map->invalid |= 1;
_ocf_cleaner_set_error(req);
env_atomic_inc(&req->cache->core_obj[map->core_id].counters->
env_atomic_inc(&req->cache->core[map->core_id].counters->
cache_errors.read);
}
@ -657,7 +657,7 @@ static int _ocf_cleaner_fire_cache(struct ocf_request *req)
if (iter->status == LOOKUP_MISS)
continue;
cache_stats = &cache->core_obj[iter->core_id].
cache_stats = &cache->core[iter->core_id].
counters->cache_blocks;
io = ocf_new_cache_io(cache);
@ -910,7 +910,7 @@ void ocf_cleaner_fire(struct ocf_cache *cache,
ocf_metadata_get_core_info(cache, cache_line, &core_id,
&core_sector);
if (unlikely(!cache->core_obj[core_id].opened)) {
if (unlikely(!cache->core[core_id].opened)) {
OCF_DEBUG_MSG(cache, "Core object inactive");
continue;
}

View File

@ -219,7 +219,7 @@ void ocf_submit_cache_reqs(struct ocf_cache *cache,
uint32_t i;
int err;
cache_stats = &cache->core_obj[req->core_id].
cache_stats = &cache->core[req->core_id].
counters->cache_blocks;
if (reqs == 1) {
@ -316,7 +316,7 @@ void ocf_submit_obj_req(ocf_data_obj_t obj, struct ocf_request *req,
struct ocf_io *io;
int err;
core_stats = &cache->core_obj[req->core_id].
core_stats = &cache->core[req->core_id].
counters->core_blocks;
if (dir == OCF_WRITE)
env_atomic64_add(req->byte_length, &core_stats->write_bytes);

View File

@ -74,7 +74,7 @@ static inline struct ocf_io *ocf_new_core_io(struct ocf_cache *cache,
{
ENV_BUG_ON(core_id >= OCF_CORE_MAX);
return ocf_dobj_new_io(&cache->core_obj[core_id].obj);
return ocf_dobj_new_io(&cache->core[core_id].obj);
}
#endif /* UTILS_IO_H_ */