From 9f5a9f0d622629298f2ad9b8c26569f2a7b9ff3e Mon Sep 17 00:00:00 2001 From: Michal Mielewczyk Date: Wed, 2 Aug 2023 09:26:21 +0200 Subject: [PATCH] casadm: '-' instead of dev path for detached cache Signed-off-by: Michal Mielewczyk --- casadm/cas_lib.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/casadm/cas_lib.c b/casadm/cas_lib.c index ff3f783..3ad51fd 100644 --- a/casadm/cas_lib.c +++ b/casadm/cas_lib.c @@ -2688,6 +2688,7 @@ int list_caches(unsigned int list_format, bool by_id_path) char cache_ctrl_dev[MAX_STR_LEN] = "-"; float cache_flush_prog; float core_flush_prog; + bool cache_device_detached; if (!by_id_path && !curr_cache->standby_detached) { if (get_dev_path(curr_cache->device, curr_cache->device, @@ -2719,11 +2720,16 @@ int list_caches(unsigned int list_format, bool by_id_path) } } + cache_device_detached = + ((curr_cache->state & (1 << ocf_cache_state_standby)) | + (curr_cache->state & (1 << ocf_cache_state_detached))) + ; + fprintf(intermediate_file[1], TAG(TREE_BRANCH) "%s,%u,%s,%s,%s,%s\n", "cache", /* type */ curr_cache->id, /* id */ - curr_cache->standby_detached ? "-" : curr_cache->device, /* device path */ + cache_device_detached ? "-" : curr_cache->device, /* device path */ tmp_status, /* cache status */ mode_string, /* write policy */ cache_ctrl_dev /* device */);