casadm: refactor printing cache incompleteness msg
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
parent
9784abefd7
commit
4dd6aae999
@ -665,8 +665,7 @@ int get_core_info(int fd, int cache_id, int core_id,
|
|||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_core_device(int cache_id, int core_id,
|
static int get_core_device(int cache_id, int core_id, struct core_device *core, bool by_id_path)
|
||||||
struct core_device *core, bool by_id_path)
|
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
struct kcas_core_info cmd_info;
|
struct kcas_core_info cmd_info;
|
||||||
@ -1818,30 +1817,18 @@ int remove_core(unsigned int cache_id, unsigned int core_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void check_cache_state_incomplete(int cache_id, int fd) {
|
void check_cache_state_incomplete(int cache_id, int fd) {
|
||||||
struct cache_device *cache;
|
struct cache_device *cache =
|
||||||
int i;
|
get_cache_device_by_id_fd(cache_id, fd, false);
|
||||||
|
|
||||||
for (i = 0; i < CORE_ADD_MAX_TIMEOUT; i++) {
|
if (cache == NULL)
|
||||||
cache = get_cache_device_by_id_fd(cache_id, fd, false);
|
|
||||||
|
|
||||||
if (cache == NULL) {
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (cache->core_count == cache->expected_core_count) {
|
|
||||||
if (cache->state & (1 << ocf_cache_state_incomplete)) {
|
if (cache->state & (1 << ocf_cache_state_incomplete)) {
|
||||||
cas_printf(LOG_WARNING, "WARNING: Cache is in incomplete state - at least one core is inactive\n");
|
cas_printf(LOG_WARNING, "WARNING: Cache is in incomplete state - "
|
||||||
}
|
"at least one core is inactive\n");
|
||||||
free(cache);
|
|
||||||
cache = NULL;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
free(cache);
|
free(cache);
|
||||||
cache = NULL;
|
|
||||||
|
|
||||||
sleep(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int remove_inactive_core(unsigned int cache_id, unsigned int core_id,
|
int remove_inactive_core(unsigned int cache_id, unsigned int core_id,
|
||||||
|
Loading…
Reference in New Issue
Block a user