Merge pull request #1168 from mmichal10/dead-code

casadm: remove dead code
This commit is contained in:
Robert Baldyga 2022-04-07 15:40:21 +02:00 committed by GitHub
commit 5854e37241
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
@ -1033,20 +1032,12 @@ int start_cache(uint16_t cache_id, unsigned int cache_init,
} }
} }
check_cache_scheduler(cache_device, check_cache_scheduler(cache_device, cmd.cache_elevator);
cmd.cache_elevator);
status = SUCCESS;
check_cache_state_incomplete(cache_id, fd); check_cache_state_incomplete(cache_id, fd);
close(fd); close(fd);
if (status == SUCCESS) { cas_printf(LOG_INFO, "Successfully added cache instance %u\n", cache_id);
cas_printf(LOG_INFO, "Successfully added cache instance %u\n", cache_id);
} else {
cas_printf(LOG_ERR, "Failed to start cache\n");
return FAILURE;
}
return SUCCESS; return SUCCESS;
} }
@ -1826,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++) {
cache = get_cache_device_by_id_fd(cache_id, fd, false);
if (cache == NULL) {
return;
}
if (cache->core_count == cache->expected_core_count) { if (cache == NULL)
if (cache->state & (1 << ocf_cache_state_incomplete)) { return;
cas_printf(LOG_WARNING, "WARNING: Cache is in incomplete state - at least one core is inactive\n");
}
free(cache);
cache = NULL;
return;
}
free(cache);
cache = NULL;
sleep(1); 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");
} }
free(cache);
} }
int remove_inactive_core(unsigned int cache_id, unsigned int core_id, int remove_inactive_core(unsigned int cache_id, unsigned int core_id,
@ -3055,7 +3034,7 @@ int standby_activate(int cache_id, const char *cache_device)
if(fd == -1) if(fd == -1)
return FAILURE; return FAILURE;
check_cache_state_incomplete(cache_id, fd); check_cache_state_incomplete(cache_id, fd);
close(fd); close(fd);
cas_printf(LOG_INFO, "Successfully activated cache instance %hu\n", cas_printf(LOG_INFO, "Successfully activated cache instance %hu\n",