Merge pull request #514 from jfckm/minor-perf

Small performance improvements
This commit is contained in:
Robert Baldyga 2021-06-14 13:32:27 +02:00 committed by GitHub
commit 6c617fa688
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 27 deletions

View File

@ -624,7 +624,6 @@ int ocf_metadata_init_variable_size(struct ocf_cache *cache,
{ {
int result = 0; int result = 0;
uint32_t i = 0; uint32_t i = 0;
ocf_cache_line_t line;
struct ocf_metadata_ctrl *ctrl = NULL; struct ocf_metadata_ctrl *ctrl = NULL;
struct ocf_cache_line_settings *settings = struct ocf_cache_line_settings *settings =
(struct ocf_cache_line_settings *)&cache->metadata.settings; (struct ocf_cache_line_settings *)&cache->metadata.settings;
@ -771,30 +770,6 @@ finalize:
ocf_cache_log(cache, log_info, "Metadata capacity: %llu MiB\n", ocf_cache_log(cache, log_info, "Metadata capacity: %llu MiB\n",
(uint64_t)ocf_metadata_size_of(cache) / MiB); (uint64_t)ocf_metadata_size_of(cache) / MiB);
/*
* Self test of metadata
*/
for (line = 0; line < cache->device->collision_table_entries; line++) {
ocf_cache_line_t phy, lg;
phy = ocf_metadata_map_lg2phy(cache, line);
lg = ocf_metadata_map_phy2lg(cache, phy);
if (line != lg) {
result = -OCF_ERR_INVAL;
break;
}
env_cond_resched();
}
if (result == 0) {
ocf_cache_log(cache, log_info,
"OCF metadata self-test PASSED\n");
} else {
ocf_cache_log(cache, log_err,
"OCF metadata self-test ERROR\n");
}
result = ocf_metadata_concurrency_attached_init(&cache->metadata.lock, result = ocf_metadata_concurrency_attached_init(&cache->metadata.lock,
cache, ctrl->raw_desc[metadata_segment_hash].entries, cache, ctrl->raw_desc[metadata_segment_hash].entries,
(uint32_t)ctrl->raw_desc[metadata_segment_collision]. (uint32_t)ctrl->raw_desc[metadata_segment_collision].

View File

@ -290,10 +290,10 @@ static inline int ocf_metadata_raw_flush_do_asynch(ocf_cache_t cache,
*/ */
static inline bool _raw_is_valid(struct ocf_metadata_raw *raw, uint32_t entry) static inline bool _raw_is_valid(struct ocf_metadata_raw *raw, uint32_t entry)
{ {
if (!raw) if (unlikely(!raw))
return false; return false;
if (entry >= raw->entries) if (unlikely(entry >= raw->entries))
return false; return false;
return true; return true;