Do not print exported object path if it was removed

Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Robert Baldyga
2022-03-25 21:36:21 +01:00
parent 92cc06766d
commit fd1b2dc121
4 changed files with 26 additions and 10 deletions

View File

@@ -2751,6 +2751,7 @@ int list_caches(unsigned int list_format, bool by_id_path)
char status_buf[CACHE_STATE_LENGHT];
const char *tmp_status;
char mode_string[12];
char exp_obj[32];
char cache_ctrl_dev[MAX_STR_LEN] = "-";
float cache_flush_prog;
float core_flush_prog;
@@ -2815,15 +2816,17 @@ int list_caches(unsigned int list_format, bool by_id_path)
tmp_status = get_core_state_name(curr_core->info.state);
}
snprintf(exp_obj, sizeof(exp_obj), "/dev/cas%d-%d",
curr_cache->id, curr_core->id);
fprintf(intermediate_file[1], TAG(TREE_LEAF)
"%s,%u,%s,%s,%s,/dev/cas%d-%d\n",
"%s,%u,%s,%s,%s,%s\n",
"core", /* type */
curr_core->id, /* id */
core_path, /* path to core*/
tmp_status, /* core status */
"-", /* write policy */
curr_cache->id, /* core id (part of path)*/
curr_core->id /* cache id (part of path)*/ );
curr_core->info.exp_obj_exists ? exp_obj : "-" /* exported object path */);
}
}

View File

@@ -188,15 +188,19 @@ static void print_core_conf(const struct kcas_core_info *info, FILE *outfile)
{
uint64_t core_size;
float core_size_gb;
char exp_obj[32];
core_size = info->info.core_size_bytes / KiB / 4;
core_size_gb = calc_gb(core_size);
snprintf(exp_obj, sizeof(exp_obj), "/dev/cas%d-%d",
info->cache_id, info->core_id);
print_kv_pair(outfile, "Core Id", "%i", info->core_id);
print_kv_pair(outfile, "Core Device", "%s",
info->core_path_name);
print_kv_pair(outfile, "Exported Object", "/dev/cas%d-%d",
info->cache_id, info->core_id);
print_kv_pair(outfile, "Exported Object", "%s",
info->exp_obj_exists ? exp_obj : "-");
print_kv_pair(outfile, "Core Size", "%lu, [" UNIT_BLOCKS "], %.2f, [GiB]",
core_size, core_size_gb);
print_kv_pair_time(outfile, "Dirty for", info->info.dirty_for);