Merge pull request #685 from arutk/stats2
Return error from stats API functions in standby
This commit is contained in:
commit
ca8531a421
@ -291,6 +291,9 @@ int ocf_core_io_class_get_stats(ocf_core_t core, ocf_part_id_t part_id,
|
||||
|
||||
cache = ocf_core_get_cache(core);
|
||||
|
||||
if (ocf_cache_is_standby(cache))
|
||||
return -OCF_ERR_CACHE_STANDBY;
|
||||
|
||||
if (!ocf_user_part_is_valid(&cache->user_parts[part_id]))
|
||||
return -OCF_ERR_IO_CLASS_NOT_EXIST;
|
||||
|
||||
@ -318,12 +321,17 @@ int ocf_core_get_stats(ocf_core_t core, struct ocf_stats_core *stats)
|
||||
uint32_t i;
|
||||
struct ocf_counters_core *core_stats = NULL;
|
||||
struct ocf_counters_part *curr = NULL;
|
||||
ocf_cache_t cache;
|
||||
|
||||
OCF_CHECK_NULL(core);
|
||||
|
||||
if (!stats)
|
||||
return -OCF_ERR_INVAL;
|
||||
|
||||
cache = ocf_core_get_cache(core);
|
||||
if (ocf_cache_is_standby(cache))
|
||||
return -OCF_ERR_CACHE_STANDBY;
|
||||
|
||||
core_stats = core->counters;
|
||||
|
||||
ENV_BUG_ON(env_memset(stats, sizeof(*stats), 0));
|
||||
|
@ -260,11 +260,14 @@ int ocf_stats_collect_part_core(ocf_core_t core, ocf_part_id_t part_id,
|
||||
|
||||
OCF_CHECK_NULL(core);
|
||||
|
||||
cache = ocf_core_get_cache(core);
|
||||
|
||||
if (ocf_cache_is_standby(cache))
|
||||
return -OCF_ERR_CACHE_STANDBY;
|
||||
|
||||
if (part_id > OCF_IO_CLASS_ID_MAX)
|
||||
return -OCF_ERR_INVAL;
|
||||
|
||||
cache = ocf_core_get_cache(core);
|
||||
|
||||
_ocf_stats_zero(usage);
|
||||
_ocf_stats_zero(req);
|
||||
_ocf_stats_zero(blocks);
|
||||
@ -288,6 +291,9 @@ int ocf_stats_collect_part_cache(ocf_cache_t cache, ocf_part_id_t part_id,
|
||||
|
||||
OCF_CHECK_NULL(cache);
|
||||
|
||||
if (ocf_cache_is_standby(cache))
|
||||
return -OCF_ERR_CACHE_STANDBY;
|
||||
|
||||
if (part_id > OCF_IO_CLASS_ID_MAX)
|
||||
return -OCF_ERR_INVAL;
|
||||
|
||||
@ -320,11 +326,15 @@ int ocf_stats_collect_core(ocf_core_t core,
|
||||
|
||||
OCF_CHECK_NULL(core);
|
||||
|
||||
cache = ocf_core_get_cache(core);
|
||||
|
||||
if (ocf_cache_is_standby(cache))
|
||||
return -OCF_ERR_CACHE_STANDBY;
|
||||
|
||||
result = ocf_core_get_stats(core, &s);
|
||||
if (result)
|
||||
return result;
|
||||
|
||||
cache = ocf_core_get_cache(core);
|
||||
cache_line_size = ocf_cache_get_line_size(cache);
|
||||
cache_size = cache->conf_meta->cachelines;
|
||||
cache_occupancy = ocf_get_cache_occupancy(cache);
|
||||
@ -399,6 +409,9 @@ int ocf_stats_collect_cache(ocf_cache_t cache,
|
||||
|
||||
OCF_CHECK_NULL(cache);
|
||||
|
||||
if (ocf_cache_is_standby(cache))
|
||||
return -OCF_ERR_CACHE_STANDBY;
|
||||
|
||||
result = ocf_cache_get_info(cache, &info);
|
||||
if (result)
|
||||
return result;
|
||||
|
Loading…
Reference in New Issue
Block a user