diff --git a/src/eviction/lru.c b/src/eviction/lru.c index 8213333..2bf9122 100644 --- a/src/eviction/lru.c +++ b/src/eviction/lru.c @@ -333,7 +333,7 @@ static void evp_lru_clean(ocf_cache_t cache, ocf_queue_t io_queue, cnt = ocf_refcnt_inc(counter); if (!cnt) { - /* cleaner disabled by mngmt operation */ + /* cleaner disabled by management operation */ return; } if (cnt > 1) { diff --git a/src/mngt/ocf_mngt_cache.c b/src/mngt/ocf_mngt_cache.c index 34c9af2..addef31 100644 --- a/src/mngt/ocf_mngt_cache.c +++ b/src/mngt/ocf_mngt_cache.c @@ -50,9 +50,9 @@ static ocf_cache_t _ocf_mngt_get_cache(ocf_ctx_t owner, "Restart with --load or --force option\n" /** - * @brief Helpful function to start cache + * @brief Helpful struct to start cache */ -struct ocf_cachemng_init_params { +struct ocf_cache_mngt_init_params { bool metadata_volatile; ocf_cache_id_t id; @@ -541,7 +541,7 @@ static void _ocf_mngt_init_instance_load( * @brief allocate memory for new cache, add it to cache queue, set initial * values and running state */ -static int _ocf_mngt_init_new_cache(struct ocf_cachemng_init_params *params) +static int _ocf_mngt_init_new_cache(struct ocf_cache_mngt_init_params *params) { ocf_cache_t cache = env_vzalloc(sizeof(*cache)); @@ -642,7 +642,7 @@ static void _ocf_mngt_attach_cache_device(ocf_pipeline_t pipeline, * @brief prepare cache for init. This is first step towards initializing * the cache */ -static int _ocf_mngt_init_prepare_cache(struct ocf_cachemng_init_params *param, +static int _ocf_mngt_init_prepare_cache(struct ocf_cache_mngt_init_params *param, struct ocf_mngt_cache_config *cfg) { ocf_cache_t cache; @@ -1104,7 +1104,7 @@ int ocf_mngt_get_ram_needed(ocf_cache_t cache, * */ static void _ocf_mngt_init_handle_error(ocf_ctx_t ctx, - struct ocf_cachemng_init_params *params) + struct ocf_cache_mngt_init_params *params) { ocf_cache_t cache = params->cache; @@ -1150,7 +1150,7 @@ static void _ocf_mngt_attach_handle_error( } static int _ocf_mngt_cache_init(ocf_cache_t cache, - struct ocf_cachemng_init_params *params) + struct ocf_cache_mngt_init_params *params) { int i; @@ -1180,7 +1180,7 @@ static int _ocf_mngt_cache_init(ocf_cache_t cache, static int _ocf_mngt_cache_start(ocf_ctx_t ctx, ocf_cache_t *cache, struct ocf_mngt_cache_config *cfg) { - struct ocf_cachemng_init_params params; + struct ocf_cache_mngt_init_params params; int result; ENV_BUG_ON(env_memset(¶ms, sizeof(params), 0)); @@ -1197,7 +1197,7 @@ static int _ocf_mngt_cache_start(ocf_ctx_t ctx, ocf_cache_t *cache, /* Prepare cache */ result = _ocf_mngt_init_prepare_cache(¶ms, cfg); if (result) - goto _cache_mng_init_instance_ERROR; + goto _cache_mngt_init_instance_ERROR; *cache = params.cache; @@ -1207,7 +1207,7 @@ static int _ocf_mngt_cache_start(ocf_ctx_t ctx, ocf_cache_t *cache, result = ocf_metadata_init(*cache, params.metadata.line_size); if (result) { result = -OCF_ERR_START_CACHE_FAIL; - goto _cache_mng_init_instance_ERROR; + goto _cache_mngt_init_instance_ERROR; } ocf_log(ctx, log_debug, "Metadata initialized\n"); @@ -1215,7 +1215,7 @@ static int _ocf_mngt_cache_start(ocf_ctx_t ctx, ocf_cache_t *cache, result = _ocf_mngt_cache_init(*cache, ¶ms); if (result) - goto _cache_mng_init_instance_ERROR; + goto _cache_mngt_init_instance_ERROR; ocf_ctx_get(ctx); @@ -1229,13 +1229,13 @@ static int _ocf_mngt_cache_start(ocf_ctx_t ctx, ocf_cache_t *cache, return 0; -_cache_mng_init_instance_ERROR: +_cache_mngt_init_instance_ERROR: _ocf_mngt_init_handle_error(ctx, ¶ms); *cache = NULL; return result; } -static void _ocf_mng_cache_set_valid(ocf_cache_t cache) +static void _ocf_mngt_cache_set_valid(ocf_cache_t cache) { /* * Clear initialization state and set the valid bit so we know @@ -1628,7 +1628,7 @@ int ocf_mngt_cache_start(ocf_ctx_t ctx, ocf_cache_t *cache, result = _ocf_mngt_cache_start(ctx, cache, cfg); if (!result) { - _ocf_mng_cache_set_valid(*cache); + _ocf_mngt_cache_set_valid(*cache); ocf_cache_log(*cache, log_info, "Successfully added\n"); ocf_cache_log(*cache, log_info, "Cache mode : %s\n", @@ -1807,7 +1807,7 @@ static void _ocf_mngt_cache_load_complete(ocf_cache_t cache, void *priv1, if (error) OCF_CMPL_RET(cache, priv2, error); - _ocf_mng_cache_set_valid(cache); + _ocf_mngt_cache_set_valid(cache); _ocf_mngt_cache_load_log(cache); OCF_CMPL_RET(cache, priv2, 0); @@ -1886,10 +1886,10 @@ static void ocf_mngt_cache_stop_remove_cores(ocf_pipeline_t pipeline, /* All exported objects removed, cleaning up rest. */ for_each_core(cache, core, core_id) { - cache_mng_core_remove_from_cache(core); + cache_mngt_core_remove_from_cache(core); if (context->cache_attached) - cache_mng_core_remove_from_cleaning_pol(core); - cache_mng_core_close(core); + cache_mngt_core_remove_from_cleaning_pol(core); + cache_mngt_core_close(core); if (--no == 0) break; } @@ -2109,7 +2109,7 @@ void ocf_mngt_cache_save(ocf_cache_t cache, ocf_mngt_cache_save_flush_sb_complete, context); } -static void _cache_mng_update_initial_dirty_clines(ocf_cache_t cache) +static void _cache_mngt_update_initial_dirty_clines(ocf_cache_t cache) { ocf_core_t core; ocf_core_id_t core_id; @@ -2122,7 +2122,7 @@ static void _cache_mng_update_initial_dirty_clines(ocf_cache_t cache) } -static int _cache_mng_set_cache_mode(ocf_cache_t cache, ocf_cache_mode_t mode) +static int _cache_mngt_set_cache_mode(ocf_cache_t cache, ocf_cache_mode_t mode) { ocf_cache_mode_t mode_old = cache->conf_meta->cache_mode; @@ -2139,7 +2139,7 @@ static int _cache_mng_set_cache_mode(ocf_cache_t cache, ocf_cache_mode_t mode) cache->conf_meta->cache_mode = mode; if (mode_old == ocf_cache_mode_wb) - _cache_mng_update_initial_dirty_clines(cache); + _cache_mngt_update_initial_dirty_clines(cache); ocf_cache_log(cache, log_info, "Changing cache mode from '%s' to '%s' " "successful\n", ocf_get_io_iface_name(mode_old), @@ -2160,7 +2160,7 @@ int ocf_mngt_cache_set_mode(ocf_cache_t cache, ocf_cache_mode_t mode) return -OCF_ERR_INVAL; } - result = _cache_mng_set_cache_mode(cache, mode); + result = _cache_mngt_set_cache_mode(cache, mode); if (result) { const char *name = ocf_get_io_iface_name(mode); @@ -2304,8 +2304,8 @@ static void ocf_mngt_cache_detach_update_metadata(ocf_pipeline_t pipeline, /* remove cacheline metadata and cleaning policy meta for all cores */ for_each_core(cache, core, core_id) { - cache_mng_core_deinit_attached_meta(core); - cache_mng_core_remove_from_cleaning_pol(core); + cache_mngt_core_deinit_attached_meta(core); + cache_mngt_core_remove_from_cleaning_pol(core); if (--no == 0) break; } diff --git a/src/mngt/ocf_mngt_common.c b/src/mngt/ocf_mngt_common.c index 95a8524..be31007 100644 --- a/src/mngt/ocf_mngt_common.c +++ b/src/mngt/ocf_mngt_common.c @@ -17,7 +17,7 @@ #include "../engine/engine_common.h" /* Close if opened */ -int cache_mng_core_close(ocf_core_t core) +int cache_mngt_core_close(ocf_core_t core) { if (!core->opened) return -OCF_ERR_CORE_IN_INACTIVE_STATE; @@ -29,7 +29,7 @@ int cache_mng_core_close(ocf_core_t core) } /* Remove core from cleaning policy */ -void cache_mng_core_remove_from_cleaning_pol(ocf_core_t core) +void cache_mngt_core_remove_from_cleaning_pol(ocf_core_t core) { ocf_cache_t cache = ocf_core_get_cache(core); ocf_core_id_t core_id = ocf_core_get_id(core); @@ -49,7 +49,7 @@ void cache_mng_core_remove_from_cleaning_pol(ocf_core_t core) } /* Deinitialize core metadata in attached metadata */ -void cache_mng_core_deinit_attached_meta(ocf_core_t core) +void cache_mngt_core_deinit_attached_meta(ocf_core_t core) { int retry = 1; uint64_t core_size = 0; @@ -88,7 +88,7 @@ void cache_mng_core_deinit_attached_meta(ocf_core_t core) } /* Mark core as removed in metadata */ -void cache_mng_core_remove_from_meta(ocf_core_t core) +void cache_mngt_core_remove_from_meta(ocf_core_t core) { ocf_cache_t cache = ocf_core_get_cache(core); @@ -105,7 +105,7 @@ void cache_mng_core_remove_from_meta(ocf_core_t core) } /* Deinit in-memory structures related to this core */ -void cache_mng_core_remove_from_cache(ocf_core_t core) +void cache_mngt_core_remove_from_cache(ocf_core_t core) { ocf_cache_t cache = ocf_core_get_cache(core); ocf_core_id_t core_id = ocf_core_get_id(core); diff --git a/src/mngt/ocf_mngt_common.h b/src/mngt/ocf_mngt_common.h index ea62439..ee77cf9 100644 --- a/src/mngt/ocf_mngt_common.h +++ b/src/mngt/ocf_mngt_common.h @@ -7,19 +7,19 @@ #ifndef __OCF_MNGT_COMMON_H__ #define __OCF_MNGT_COMMON_H__ -int cache_mng_core_close(ocf_core_t core); +int cache_mngt_core_close(ocf_core_t core); -void cache_mng_core_remove_from_meta(ocf_core_t core); +void cache_mngt_core_remove_from_meta(ocf_core_t core); -void cache_mng_core_remove_from_cache(ocf_core_t core); +void cache_mngt_core_remove_from_cache(ocf_core_t core); -void cache_mng_core_deinit_attached_meta(ocf_core_t core); +void cache_mngt_core_deinit_attached_meta(ocf_core_t core); -void cache_mng_core_remove_from_cleaning_pol(ocf_core_t core); +void cache_mngt_core_remove_from_cleaning_pol(ocf_core_t core); int _ocf_cleaning_thread(void *priv); -int cache_mng_thread_io_requests(void *data); +int cache_mngt_thread_io_requests(void *data); bool ocf_mngt_cache_is_dirty(ocf_cache_t cache); diff --git a/src/mngt/ocf_mngt_core.c b/src/mngt/ocf_mngt_core.c index 414b2f9..c410397 100644 --- a/src/mngt/ocf_mngt_core.c +++ b/src/mngt/ocf_mngt_core.c @@ -663,12 +663,12 @@ static void _ocf_mngt_cache_remove_core(ocf_pipeline_t pipeline, void *priv, /* Deinit everything*/ if (ocf_cache_is_device_attached(cache)) { - cache_mng_core_deinit_attached_meta(core); - cache_mng_core_remove_from_cleaning_pol(core); + cache_mngt_core_deinit_attached_meta(core); + cache_mngt_core_remove_from_cleaning_pol(core); } - cache_mng_core_remove_from_meta(core); - cache_mng_core_remove_from_cache(core); - cache_mng_core_close(core); + cache_mngt_core_remove_from_meta(core); + cache_mngt_core_remove_from_cache(core); + cache_mngt_core_close(core); /* Update super-block with core device removal */ ocf_metadata_flush_superblock(cache, @@ -758,7 +758,7 @@ static void _ocf_mngt_cache_detach_core(ocf_pipeline_t pipeline, ocf_core_log(core, log_debug, "Detaching core\n"); - status = cache_mng_core_close(core); + status = cache_mngt_core_close(core); if (status) OCF_PL_FINISH_RET(pipeline, status); @@ -912,7 +912,7 @@ int ocf_mngt_core_get_user_metadata(ocf_core_t core, void *data, size_t size) return 0; } -static int _cache_mng_set_core_seq_cutoff_threshold(ocf_core_t core, void *cntx) +static int _cache_mngt_set_core_seq_cutoff_threshold(ocf_core_t core, void *cntx) { uint32_t threshold = *(uint32_t*) cntx; uint32_t threshold_old = core->conf_meta->seq_cutoff_threshold; @@ -936,7 +936,7 @@ int ocf_mngt_core_set_seq_cutoff_threshold(ocf_core_t core, uint32_t thresh) { OCF_CHECK_NULL(core); - return _cache_mng_set_core_seq_cutoff_threshold(core, &thresh); + return _cache_mngt_set_core_seq_cutoff_threshold(core, &thresh); } int ocf_mngt_core_set_seq_cutoff_threshold_all(ocf_cache_t cache, @@ -944,7 +944,7 @@ int ocf_mngt_core_set_seq_cutoff_threshold_all(ocf_cache_t cache, { OCF_CHECK_NULL(cache); - return ocf_core_visit(cache, _cache_mng_set_core_seq_cutoff_threshold, + return ocf_core_visit(cache, _cache_mngt_set_core_seq_cutoff_threshold, &thresh, true); } @@ -964,7 +964,7 @@ static const char *_ocf_seq_cutoff_policy_names[ocf_seq_cutoff_policy_max] = { [ocf_seq_cutoff_policy_never] = "never", }; -static const char *_cache_mng_seq_cutoff_policy_get_name( +static const char *_cache_mngt_seq_cutoff_policy_get_name( ocf_seq_cutoff_policy policy) { if (policy < 0 || policy >= ocf_seq_cutoff_policy_max) @@ -973,7 +973,7 @@ static const char *_cache_mng_seq_cutoff_policy_get_name( return _ocf_seq_cutoff_policy_names[policy]; } -static int _cache_mng_set_core_seq_cutoff_policy(ocf_core_t core, void *cntx) +static int _cache_mngt_set_core_seq_cutoff_policy(ocf_core_t core, void *cntx) { ocf_seq_cutoff_policy policy = *(ocf_seq_cutoff_policy*) cntx; uint32_t policy_old = core->conf_meta->seq_cutoff_policy; @@ -981,7 +981,7 @@ static int _cache_mng_set_core_seq_cutoff_policy(ocf_core_t core, void *cntx) if (policy_old == policy) { ocf_core_log(core, log_info, "Sequential cutoff policy %s is already set\n", - _cache_mng_seq_cutoff_policy_get_name(policy)); + _cache_mngt_seq_cutoff_policy_get_name(policy)); return 0; } @@ -995,8 +995,8 @@ static int _cache_mng_set_core_seq_cutoff_policy(ocf_core_t core, void *cntx) ocf_core_log(core, log_info, "Changing sequential cutoff policy from %s to %s\n", - _cache_mng_seq_cutoff_policy_get_name(policy_old), - _cache_mng_seq_cutoff_policy_get_name(policy)); + _cache_mngt_seq_cutoff_policy_get_name(policy_old), + _cache_mngt_seq_cutoff_policy_get_name(policy)); return 0; } @@ -1006,14 +1006,14 @@ int ocf_mngt_core_set_seq_cutoff_policy(ocf_core_t core, { OCF_CHECK_NULL(core); - return _cache_mng_set_core_seq_cutoff_policy(core, &policy); + return _cache_mngt_set_core_seq_cutoff_policy(core, &policy); } int ocf_mngt_core_set_seq_cutoff_policy_all(ocf_cache_t cache, ocf_seq_cutoff_policy policy) { OCF_CHECK_NULL(cache); - return ocf_core_visit(cache, _cache_mng_set_core_seq_cutoff_policy, + return ocf_core_visit(cache, _cache_mngt_set_core_seq_cutoff_policy, &policy, true); } diff --git a/src/mngt/ocf_mngt_flush.c b/src/mngt/ocf_mngt_flush.c index 196784d..48f8859 100644 --- a/src/mngt/ocf_mngt_flush.c +++ b/src/mngt/ocf_mngt_flush.c @@ -55,7 +55,7 @@ struct ocf_mngt_cache_flush_context purge_core } op; - /* ocf mngmt entry point completion */ + /* ocf management entry point completion */ union { ocf_mngt_cache_flush_end_t flush_cache; ocf_mngt_core_flush_end_t flush_core; diff --git a/tests/unit/tests/mngt/ocf_mngt_cache.c/_cache_mng_set_cache_mode_test.c b/tests/unit/tests/mngt/ocf_mngt_cache.c/_cache_mngt_set_cache_mode_test.c similarity index 90% rename from tests/unit/tests/mngt/ocf_mngt_cache.c/_cache_mng_set_cache_mode_test.c rename to tests/unit/tests/mngt/ocf_mngt_cache.c/_cache_mngt_set_cache_mode_test.c index 0cd495f..181d45d 100644 --- a/tests/unit/tests/mngt/ocf_mngt_cache.c/_cache_mng_set_cache_mode_test.c +++ b/tests/unit/tests/mngt/ocf_mngt_cache.c/_cache_mngt_set_cache_mode_test.c @@ -4,7 +4,7 @@ */ //src/mngt/ocf_mngt_cache.c -//_cache_mng_set_cache_mode +//_cache_mngt_set_cache_mode /* @@ -265,12 +265,12 @@ void __wrap_ocf_mngt_cache_save_finish( { } -void _cache_mng_update_initial_dirty_clines(ocf_cache_t cache) +void _cache_mngt_update_initial_dirty_clines(ocf_cache_t cache) { function_called(); } -static void _cache_mng_set_cache_mode_test01(void **state) +static void _cache_mngt_set_cache_mode_test01(void **state) { ocf_cache_mode_t mode_old = -20; ocf_cache_mode_t mode_new = ocf_cache_mode_none; @@ -291,13 +291,13 @@ static void _cache_mng_set_cache_mode_test01(void **state) expect_function_call(__wrap_ocf_cache_mode_is_valid); will_return(__wrap_ocf_cache_mode_is_valid, 0); - result = _cache_mng_set_cache_mode(&cache, mode_new); + result = _cache_mngt_set_cache_mode(&cache, mode_new); assert_int_equal(result, -OCF_ERR_INVAL); assert_int_equal(cache.conf_meta->cache_mode, mode_old); } -static void _cache_mng_set_cache_mode_test02(void **state) +static void _cache_mngt_set_cache_mode_test02(void **state) { ocf_cache_mode_t mode_old = ocf_cache_mode_wt; ocf_cache_mode_t mode_new = ocf_cache_mode_wt; @@ -322,13 +322,13 @@ static void _cache_mng_set_cache_mode_test02(void **state) expect_function_call(__wrap_ocf_log_raw); will_return(__wrap_ocf_log_raw, 0); - result = _cache_mng_set_cache_mode(&cache, mode_new); + result = _cache_mngt_set_cache_mode(&cache, mode_new); assert_int_equal(result, 0); assert_int_equal(cache.conf_meta->cache_mode, mode_old); } -static void _cache_mng_set_cache_mode_test03(void **state) +static void _cache_mngt_set_cache_mode_test03(void **state) { ocf_cache_mode_t mode_old = ocf_cache_mode_wb; ocf_cache_mode_t mode_new = ocf_cache_mode_wa; @@ -351,18 +351,18 @@ static void _cache_mng_set_cache_mode_test03(void **state) expect_function_call(__wrap_ocf_cache_mode_is_valid); will_return(__wrap_ocf_cache_mode_is_valid, 1); - expect_function_call(_cache_mng_update_initial_dirty_clines); + expect_function_call(_cache_mngt_update_initial_dirty_clines); expect_function_call(__wrap_ocf_log_raw); will_return(__wrap_ocf_log_raw, 0); - result = _cache_mng_set_cache_mode(&cache, mode_new); + result = _cache_mngt_set_cache_mode(&cache, mode_new); assert_int_equal(result, 0); assert_int_equal(cache.conf_meta->cache_mode, mode_new); } -static void _cache_mng_set_cache_mode_test04(void **state) +static void _cache_mngt_set_cache_mode_test04(void **state) { ocf_cache_mode_t mode_old = ocf_cache_mode_wt; ocf_cache_mode_t mode_new = ocf_cache_mode_wa; @@ -387,7 +387,7 @@ static void _cache_mng_set_cache_mode_test04(void **state) expect_function_call(__wrap_ocf_log_raw); will_return(__wrap_ocf_log_raw, 0); - result = _cache_mng_set_cache_mode(&cache, mode_new); + result = _cache_mngt_set_cache_mode(&cache, mode_new); assert_int_equal(result, 0); assert_int_equal(cache.conf_meta->cache_mode, mode_new); @@ -399,13 +399,13 @@ static void _cache_mng_set_cache_mode_test04(void **state) int main(void) { const struct CMUnitTest tests[] = { - cmocka_unit_test(_cache_mng_set_cache_mode_test01), - cmocka_unit_test(_cache_mng_set_cache_mode_test02), - cmocka_unit_test(_cache_mng_set_cache_mode_test03), - cmocka_unit_test(_cache_mng_set_cache_mode_test04), + cmocka_unit_test(_cache_mngt_set_cache_mode_test01), + cmocka_unit_test(_cache_mngt_set_cache_mode_test02), + cmocka_unit_test(_cache_mngt_set_cache_mode_test03), + cmocka_unit_test(_cache_mngt_set_cache_mode_test04), }; - print_message("Unit test of _cache_mng_set_cache_mode\n"); + print_message("Unit test of _cache_mngt_set_cache_mode\n"); return cmocka_run_group_tests(tests, NULL, NULL); } diff --git a/tests/unit/tests/mngt/ocf_mngt_cache.c/ocf_mngt_cache_set_fallback_pt_error_threshold.c b/tests/unit/tests/mngt/ocf_mngt_cache.c/ocf_mngt_cache_set_fallback_pt_error_threshold.c index f924954..5f3b85e 100644 --- a/tests/unit/tests/mngt/ocf_mngt_cache.c/ocf_mngt_cache_set_fallback_pt_error_threshold.c +++ b/tests/unit/tests/mngt/ocf_mngt_cache.c/ocf_mngt_cache_set_fallback_pt_error_threshold.c @@ -45,7 +45,7 @@ ocf_ctx_t __wrap_ocf_cache_get_ctx(ocf_cache_t cache) function_called(); } -int __wrap_ocf_mng_cache_set_fallback_pt(ocf_cache_t cache) +int __wrap_ocf_mngt_cache_set_fallback_pt(ocf_cache_t cache) { function_called(); }