diff --git a/casadm/cas_lib.c b/casadm/cas_lib.c index c02046d..e1a0c87 100644 --- a/casadm/cas_lib.c +++ b/casadm/cas_lib.c @@ -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 */); } } diff --git a/casadm/statistics_model.c b/casadm/statistics_model.c index 6d42b75..252372e 100644 --- a/casadm/statistics_model.c +++ b/casadm/statistics_model.c @@ -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); diff --git a/modules/cas_cache/layer_cache_management.c b/modules/cas_cache/layer_cache_management.c index b5ce52a..68cc14a 100644 --- a/modules/cas_cache/layer_cache_management.c +++ b/modules/cas_cache/layer_cache_management.c @@ -1567,7 +1567,7 @@ int cache_mngt_remove_core_from_cache(struct kcas_remove_core *cmd) wait_for_completion(&context.cmpl); - if (!result && !cmd->detach) + if (result != -OCF_ERR_CORE_NOT_REMOVED && !cmd->detach) mark_core_id_free(cache, cmd->core_id); unlock: @@ -3123,6 +3123,8 @@ int cache_mngt_get_core_info(struct kcas_core_info *info) ocf_cache_t cache; ocf_core_t core; const struct ocf_volume_uuid *uuid; + ocf_volume_t vol; + struct bd_object *bdvol; int result; result = mngt_get_cache_by_id(cas_ctx, info->cache_id, &cache); @@ -3152,6 +3154,10 @@ int cache_mngt_get_core_info(struct kcas_core_info *info) info->state = ocf_core_get_state(core); + vol = ocf_core_get_volume(core); + bdvol = bd_object(vol); + info->exp_obj_exists = bdvol->expobj_valid; + unlock: ocf_mngt_cache_read_unlock(cache); put: diff --git a/modules/include/cas_ioctl_codes.h b/modules/include/cas_ioctl_codes.h index 8eb7bf2..656986f 100644 --- a/modules/include/cas_ioctl_codes.h +++ b/modules/include/cas_ioctl_codes.h @@ -205,6 +205,8 @@ struct kcas_core_info { ocf_core_state_t state; + bool exp_obj_exists; + int ext_err_code; }; @@ -393,7 +395,7 @@ struct kcas_standby_activate * 22 * KCAS_IOCTL_INSERT_CORE * OK * * 23 * KCAS_IOCTL_REMOVE_CORE * OK * * 24 * KCAS_IOCTL_CACHE_INFO * OK * - * 25 * KCAS_IOCTL_CORE_INFO * OK * + * 25 * KCAS_IOCTL_CORE_INFO * DEPERCATED * * 26 * KCAS_IOCTL_GET_CORE_POOL_COUNT * OK * * 27 * KCAS_IOCTL_GET_CORE_POOL_PATHS * OK * * 28 * KCAS_IOCTL_CORE_POOL_REMOVE * OK * @@ -408,6 +410,7 @@ struct kcas_standby_activate * 37 * KCAS_IOCTL_REMOVE_INACTIVE * OK * * 38 * KCAS_IOCTL_STANDBY_DETACH * OK * * 39 * KCAS_IOCTL_STANDBY_ACTIVATE * OK * + * 40 * KCAS_IOCTL_CORE_INFO * OK * ******************************************************************************* */ @@ -459,9 +462,6 @@ struct kcas_standby_activate /** Retrieve properties of a running cache instance (incl. mode etc.) */ #define KCAS_IOCTL_CACHE_INFO _IOWR(KCAS_IOCTL_MAGIC, 24, struct kcas_cache_info) -/** Rretrieve statisting of a given core object */ -#define KCAS_IOCTL_CORE_INFO _IOWR(KCAS_IOCTL_MAGIC, 25, struct kcas_core_info) - /** Get core pool count */ #define KCAS_IOCTL_GET_CORE_POOL_COUNT _IOR(KCAS_IOCTL_MAGIC, 26, struct kcas_core_pool_count) @@ -506,6 +506,9 @@ struct kcas_standby_activate /** Activate failover standby cache instance */ #define KCAS_IOCTL_STANDBY_ACTIVATE _IOWR(KCAS_IOCTL_MAGIC, 39, struct kcas_standby_activate) +/** Rretrieve statisting of a given core object */ +#define KCAS_IOCTL_CORE_INFO _IOWR(KCAS_IOCTL_MAGIC, 40, struct kcas_core_info) + /** * Extended kernel CAS error codes */