Handle separate functons for retrieving core stats and info.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk 2019-09-02 09:14:53 -04:00
parent 1abb1e7c72
commit 39a3d04c93
5 changed files with 12 additions and 13 deletions

View File

@ -2683,11 +2683,11 @@ int list_caches(unsigned int list_format)
curr_core = &curr_cache->cores[j];
core_path = curr_core->path;
core_flush_prog = calculate_flush_progress(curr_core->info.stats.dirty,
curr_core->info.stats.flushed);
core_flush_prog = calculate_flush_progress(curr_core->info.info.dirty,
curr_core->info.info.flushed);
if (!core_flush_prog && cache_flush_prog) {
core_flush_prog = curr_core->info.stats.dirty ? 0 : 100;
core_flush_prog = curr_core->info.info.dirty ? 0 : 100;
}
if (core_flush_prog || cache_flush_prog) {

View File

@ -295,8 +295,8 @@ void get_core_flush_progress(int fd, int cache_id, int core_id, float *prog)
cmd_info.core_id = core_id;
if (0 == ioctl(fd, KCAS_IOCTL_CORE_INFO, &cmd_info)) {
*prog = calculate_flush_progress(cmd_info.stats.dirty,
cmd_info.stats.flushed);
*prog = calculate_flush_progress(cmd_info.info.dirty,
cmd_info.info.flushed);
}
}
@ -367,7 +367,7 @@ void *print_command_progress(void *th_arg)
} else if (EINTR == errno) {
interrupted = 1;
} else { /* other error conditions are EFAULT or EINVAL
* cannot happen in realistic conditions,
* cannot happen in realistic conditions,
* and are likely to refer to OS errors, which
* cannot possibly be handled. Perform abortion.
*/

View File

@ -189,7 +189,7 @@ static void print_core_conf(const struct kcas_core_info *info, FILE *outfile)
uint64_t core_size;
float core_size_gb;
core_size = info->stats.core_size_bytes / KiB / 4;
core_size = info->info.core_size_bytes / KiB / 4;
core_size_gb = calc_gb(core_size);
print_kv_pair(outfile, "Core Id", "%i", info->core_id);
@ -199,16 +199,16 @@ static void print_core_conf(const struct kcas_core_info *info, FILE *outfile)
info->cache_id, info->core_id);
print_kv_pair(outfile, "Core Size", "%lu, [4KiB Blocks], %.2f, [GiB]",
core_size, core_size_gb);
print_kv_pair_time(outfile, "Dirty for", info->stats.dirty_for);
print_kv_pair_time(outfile, "Dirty for", info->info.dirty_for);
print_kv_pair(outfile, "Status", "%s",
get_core_state_name(info->state));
print_kv_pair(outfile, "Seq cutoff threshold", "%llu, [KiB]",
info->stats.seq_cutoff_threshold / KiB);
info->info.seq_cutoff_threshold / KiB);
print_kv_pair(outfile, "Seq cutoff policy", "%s",
seq_cutoff_policy_to_name(info->stats.seq_cutoff_policy));
seq_cutoff_policy_to_name(info->info.seq_cutoff_policy));
}
static void print_usage_header(FILE* outfile)

View File

@ -1909,7 +1909,7 @@ int cache_mngt_get_core_info(struct kcas_core_info *info)
goto unlock;
}
result = ocf_core_get_stats(core, &info->stats);
result = ocf_core_get_info(core, &info->info);
if (result)
goto unlock;

View File

@ -208,8 +208,7 @@ struct kcas_core_info {
/** Core id */
uint16_t core_id;
/** CAS statistics of core */
struct ocf_stats_core stats;
struct ocf_core_info info;
ocf_core_state_t state;