commit
213b8bcaac
@ -2028,7 +2028,7 @@ int partition_list(unsigned int cache_id, unsigned int output_format)
|
|||||||
io_class.cache_id = cache_id;
|
io_class.cache_id = cache_id;
|
||||||
io_class.class_id = i;
|
io_class.class_id = i;
|
||||||
|
|
||||||
result = run_ioctl(fd, KCAS_IOCTL_PARTITION_STATS, &io_class);
|
result = run_ioctl(fd, KCAS_IOCTL_PARTITION_INFO, &io_class);
|
||||||
if (result) {
|
if (result) {
|
||||||
if (OCF_ERR_IO_CLASS_NOT_EXIST == io_class.ext_err_code) {
|
if (OCF_ERR_IO_CLASS_NOT_EXIST == io_class.ext_err_code) {
|
||||||
result = SUCCESS;
|
result = SUCCESS;
|
||||||
@ -2683,11 +2683,11 @@ int list_caches(unsigned int list_format)
|
|||||||
curr_core = &curr_cache->cores[j];
|
curr_core = &curr_cache->cores[j];
|
||||||
core_path = curr_core->path;
|
core_path = curr_core->path;
|
||||||
|
|
||||||
core_flush_prog = calculate_flush_progress(curr_core->info.stats.dirty,
|
core_flush_prog = calculate_flush_progress(curr_core->info.info.dirty,
|
||||||
curr_core->info.stats.flushed);
|
curr_core->info.info.flushed);
|
||||||
|
|
||||||
if (!core_flush_prog && cache_flush_prog) {
|
if (!core_flush_prog && cache_flush_prog) {
|
||||||
core_flush_prog = curr_core->info.stats.dirty ? 0 : 100;
|
core_flush_prog = curr_core->info.info.dirty ? 0 : 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (core_flush_prog || cache_flush_prog) {
|
if (core_flush_prog || cache_flush_prog) {
|
||||||
|
@ -295,8 +295,8 @@ void get_core_flush_progress(int fd, int cache_id, int core_id, float *prog)
|
|||||||
cmd_info.core_id = core_id;
|
cmd_info.core_id = core_id;
|
||||||
|
|
||||||
if (0 == ioctl(fd, KCAS_IOCTL_CORE_INFO, &cmd_info)) {
|
if (0 == ioctl(fd, KCAS_IOCTL_CORE_INFO, &cmd_info)) {
|
||||||
*prog = calculate_flush_progress(cmd_info.stats.dirty,
|
*prog = calculate_flush_progress(cmd_info.info.dirty,
|
||||||
cmd_info.stats.flushed);
|
cmd_info.info.flushed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ static struct command_args command_args_values = {
|
|||||||
.cache_mode = ocf_cache_mode_default,
|
.cache_mode = ocf_cache_mode_default,
|
||||||
.stats_filters = STATS_FILTER_DEFAULT,
|
.stats_filters = STATS_FILTER_DEFAULT,
|
||||||
.output_format = OUTPUT_FORMAT_DEFAULT,
|
.output_format = OUTPUT_FORMAT_DEFAULT,
|
||||||
.io_class_id = -1,
|
.io_class_id = OCF_IO_CLASS_INVALID,
|
||||||
.line_size = ocf_cache_line_size_default,
|
.line_size = ocf_cache_line_size_default,
|
||||||
.cache_state_flush = UNDEFINED, /* three state logic: YES NO UNDEFINED */
|
.cache_state_flush = UNDEFINED, /* three state logic: YES NO UNDEFINED */
|
||||||
.flush_data = 1,
|
.flush_data = 1,
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1753,6 +1753,58 @@ int cache_mngt_interrupt_flushing(const char *cache_name)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int cache_mngt_get_stats(struct kcas_get_stats *stats)
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
ocf_cache_t cache;
|
||||||
|
ocf_core_t core = NULL;
|
||||||
|
|
||||||
|
result = mngt_get_cache_by_id(cas_ctx, stats->cache_id, &cache);
|
||||||
|
if (result)
|
||||||
|
return result;
|
||||||
|
|
||||||
|
result = _cache_mngt_read_lock_sync(cache);
|
||||||
|
if (result)
|
||||||
|
goto put;
|
||||||
|
|
||||||
|
if (stats->core_id == OCF_CORE_ID_INVALID &&
|
||||||
|
stats->part_id == OCF_IO_CLASS_INVALID) {
|
||||||
|
result = ocf_stats_collect_cache(cache, &stats->usage, &stats->req,
|
||||||
|
&stats->blocks, &stats->errors);
|
||||||
|
if (result)
|
||||||
|
goto unlock;
|
||||||
|
|
||||||
|
} else if (stats->part_id == OCF_IO_CLASS_INVALID) {
|
||||||
|
result = get_core_by_id(cache, stats->core_id, &core);
|
||||||
|
if (result)
|
||||||
|
goto unlock;
|
||||||
|
|
||||||
|
result = ocf_stats_collect_core(core, &stats->usage, &stats->req,
|
||||||
|
&stats->blocks, &stats->errors);
|
||||||
|
if (result)
|
||||||
|
goto unlock;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (stats->core_id == OCF_CORE_ID_INVALID) {
|
||||||
|
result = ocf_stats_collect_part_cache(cache, stats->part_id,
|
||||||
|
&stats->usage, &stats->req, &stats->blocks);
|
||||||
|
} else {
|
||||||
|
result = get_core_by_id(cache, stats->core_id, &core);
|
||||||
|
if (result)
|
||||||
|
goto unlock;
|
||||||
|
|
||||||
|
result = ocf_stats_collect_part_core(core, stats->part_id,
|
||||||
|
&stats->usage, &stats->req, &stats->blocks);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unlock:
|
||||||
|
ocf_mngt_cache_read_unlock(cache);
|
||||||
|
put:
|
||||||
|
ocf_mngt_cache_put(cache);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
int cache_mngt_get_info(struct kcas_cache_info *info)
|
int cache_mngt_get_info(struct kcas_cache_info *info)
|
||||||
{
|
{
|
||||||
uint32_t i, j;
|
uint32_t i, j;
|
||||||
@ -1813,10 +1865,8 @@ int cache_mngt_get_io_class_info(struct kcas_io_class *part)
|
|||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
uint16_t cache_id = part->cache_id;
|
uint16_t cache_id = part->cache_id;
|
||||||
uint16_t core_id = part->core_id;
|
|
||||||
uint32_t io_class_id = part->class_id;
|
uint32_t io_class_id = part->class_id;
|
||||||
ocf_cache_t cache;
|
ocf_cache_t cache;
|
||||||
ocf_core_t core;
|
|
||||||
|
|
||||||
result = mngt_get_cache_by_id(cas_ctx, cache_id, &cache);
|
result = mngt_get_cache_by_id(cas_ctx, cache_id, &cache);
|
||||||
if (result)
|
if (result)
|
||||||
@ -1832,17 +1882,6 @@ int cache_mngt_get_io_class_info(struct kcas_io_class *part)
|
|||||||
if (result)
|
if (result)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
if (part->get_stats) {
|
|
||||||
result = get_core_by_id(cache, core_id, &core);
|
|
||||||
if (result < 0) {
|
|
||||||
result = OCF_ERR_CORE_NOT_AVAIL;
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = ocf_core_io_class_get_stats(core, io_class_id,
|
|
||||||
&part->stats);
|
|
||||||
}
|
|
||||||
|
|
||||||
end:
|
end:
|
||||||
ocf_mngt_cache_read_unlock(cache);
|
ocf_mngt_cache_read_unlock(cache);
|
||||||
ocf_mngt_cache_put(cache);
|
ocf_mngt_cache_put(cache);
|
||||||
@ -1870,7 +1909,7 @@ int cache_mngt_get_core_info(struct kcas_core_info *info)
|
|||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = ocf_core_get_stats(core, &info->stats);
|
result = ocf_core_get_info(core, &info->info);
|
||||||
if (result)
|
if (result)
|
||||||
goto unlock;
|
goto unlock;
|
||||||
|
|
||||||
|
@ -73,6 +73,8 @@ int cache_mngt_list_caches(struct kcas_cache_list *list);
|
|||||||
|
|
||||||
int cache_mngt_interrupt_flushing(const char *cache_name);
|
int cache_mngt_interrupt_flushing(const char *cache_name);
|
||||||
|
|
||||||
|
int cache_mngt_get_stats(struct kcas_get_stats *stats);
|
||||||
|
|
||||||
int cache_mngt_get_info(struct kcas_cache_info *info);
|
int cache_mngt_get_info(struct kcas_cache_info *info);
|
||||||
|
|
||||||
int cache_mngt_get_io_class_info(struct kcas_io_class *part);
|
int cache_mngt_get_io_class_info(struct kcas_io_class *part);
|
||||||
|
@ -51,7 +51,7 @@ long cas_service_ioctl_ctrl(struct file *filp, unsigned int cmd,
|
|||||||
cmd != KCAS_IOCTL_LIST_CACHE &&
|
cmd != KCAS_IOCTL_LIST_CACHE &&
|
||||||
cmd != KCAS_IOCTL_GET_CACHE_COUNT &&
|
cmd != KCAS_IOCTL_GET_CACHE_COUNT &&
|
||||||
cmd != KCAS_IOCTL_CORE_INFO &&
|
cmd != KCAS_IOCTL_CORE_INFO &&
|
||||||
cmd != KCAS_IOCTL_PARTITION_STATS &&
|
cmd != KCAS_IOCTL_PARTITION_INFO &&
|
||||||
cmd != KCAS_IOCTL_GET_CAPABILITIES) {
|
cmd != KCAS_IOCTL_GET_CAPABILITIES) {
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
@ -193,6 +193,16 @@ long cas_service_ioctl_ctrl(struct file *filp, unsigned int cmd,
|
|||||||
RETURN_CMD_RESULT(cmd_info, arg, retval);
|
RETURN_CMD_RESULT(cmd_info, arg, retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case KCAS_IOCTL_GET_STATS: {
|
||||||
|
struct kcas_get_stats *cmd_info;
|
||||||
|
|
||||||
|
GET_CMD_INFO(cmd_info, arg);
|
||||||
|
|
||||||
|
retval = cache_mngt_get_stats(cmd_info);
|
||||||
|
|
||||||
|
RETURN_CMD_RESULT(cmd_info, arg, retval);
|
||||||
|
}
|
||||||
|
|
||||||
case KCAS_IOCTL_CACHE_INFO: {
|
case KCAS_IOCTL_CACHE_INFO: {
|
||||||
struct kcas_cache_info *cmd_info;
|
struct kcas_cache_info *cmd_info;
|
||||||
|
|
||||||
@ -213,7 +223,7 @@ long cas_service_ioctl_ctrl(struct file *filp, unsigned int cmd,
|
|||||||
RETURN_CMD_RESULT(cmd_info, arg, retval);
|
RETURN_CMD_RESULT(cmd_info, arg, retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
case KCAS_IOCTL_PARTITION_STATS: {
|
case KCAS_IOCTL_PARTITION_INFO: {
|
||||||
struct kcas_io_class *cmd_info;
|
struct kcas_io_class *cmd_info;
|
||||||
|
|
||||||
GET_CMD_INFO(cmd_info, arg);
|
GET_CMD_INFO(cmd_info, arg);
|
||||||
|
@ -157,6 +157,28 @@ struct kcas_flush_core {
|
|||||||
int ext_err_code;
|
int ext_err_code;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct kcas_get_stats {
|
||||||
|
/** id of a cache */
|
||||||
|
uint16_t cache_id;
|
||||||
|
|
||||||
|
/** id of a core */
|
||||||
|
uint16_t core_id;
|
||||||
|
|
||||||
|
/** id of an ioclass */
|
||||||
|
uint16_t part_id;
|
||||||
|
|
||||||
|
/** fields to be filled with statistics */
|
||||||
|
struct ocf_stats_usage usage;
|
||||||
|
|
||||||
|
struct ocf_stats_requests req;
|
||||||
|
|
||||||
|
struct ocf_stats_blocks blocks;
|
||||||
|
|
||||||
|
struct ocf_stats_errors errors;
|
||||||
|
|
||||||
|
int ext_err_code;
|
||||||
|
};
|
||||||
|
|
||||||
struct kcas_cache_info {
|
struct kcas_cache_info {
|
||||||
/** id of a cache */
|
/** id of a cache */
|
||||||
uint16_t cache_id;
|
uint16_t cache_id;
|
||||||
@ -186,8 +208,7 @@ struct kcas_core_info {
|
|||||||
/** Core id */
|
/** Core id */
|
||||||
uint16_t core_id;
|
uint16_t core_id;
|
||||||
|
|
||||||
/** CAS statistics of core */
|
struct ocf_core_info info;
|
||||||
struct ocf_stats_core stats;
|
|
||||||
|
|
||||||
ocf_core_state_t state;
|
ocf_core_state_t state;
|
||||||
|
|
||||||
@ -225,21 +246,12 @@ struct kcas_io_class {
|
|||||||
/** Cache ID */
|
/** Cache ID */
|
||||||
uint16_t cache_id;
|
uint16_t cache_id;
|
||||||
|
|
||||||
/** Core ID */
|
|
||||||
uint16_t core_id;
|
|
||||||
|
|
||||||
/** IO class id for which info will be retrieved */
|
/** IO class id for which info will be retrieved */
|
||||||
uint32_t class_id;
|
uint32_t class_id;
|
||||||
|
|
||||||
/** IO class info */
|
/** IO class info */
|
||||||
struct ocf_io_class_info info;
|
struct ocf_io_class_info info;
|
||||||
|
|
||||||
/** Flag indicating if partition counters should be fetched. */
|
|
||||||
uint8_t get_stats;
|
|
||||||
|
|
||||||
/** IO class statistics */
|
|
||||||
struct ocf_stats_io_class stats;
|
|
||||||
|
|
||||||
int ext_err_code;
|
int ext_err_code;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -385,7 +397,7 @@ struct kcas_get_cache_param {
|
|||||||
* 11 * KCAS_IOCTL_FLUSH_CORE * OK *
|
* 11 * KCAS_IOCTL_FLUSH_CORE * OK *
|
||||||
* 12 * KCAS_IOCTL_CACHE_INFO * DEPRECATED *
|
* 12 * KCAS_IOCTL_CACHE_INFO * DEPRECATED *
|
||||||
* 13 * KCAS_IOCTL_CORE_INFO * DEPRECATED *
|
* 13 * KCAS_IOCTL_CORE_INFO * DEPRECATED *
|
||||||
* 14 * KCAS_IOCTL_PARTITION_STATS * OK *
|
* 14 * KCAS_IOCTL_PARTITION_INFO * OK *
|
||||||
* 15 * KCAS_IOCTL_PARTITION_SET * OK *
|
* 15 * KCAS_IOCTL_PARTITION_SET * OK *
|
||||||
* 16 * KCAS_IOCTL_GET_CACHE_COUNT * OK *
|
* 16 * KCAS_IOCTL_GET_CACHE_COUNT * OK *
|
||||||
* 17 * KCAS_IOCTL_LIST_CACHE * OK *
|
* 17 * KCAS_IOCTL_LIST_CACHE * OK *
|
||||||
@ -405,6 +417,7 @@ struct kcas_get_cache_param {
|
|||||||
* 31 * KCAS_IOCTL_GET_CORE_PARAM * OK *
|
* 31 * KCAS_IOCTL_GET_CORE_PARAM * OK *
|
||||||
* 32 * KCAS_IOCTL_SET_CACHE_PARAM * OK *
|
* 32 * KCAS_IOCTL_SET_CACHE_PARAM * OK *
|
||||||
* 33 * KCAS_IOCTL_GET_CACHE_PARAM * OK *
|
* 33 * KCAS_IOCTL_GET_CACHE_PARAM * OK *
|
||||||
|
* 34 * KCAS_IOCTL_GET_STATS * OK *
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -433,7 +446,7 @@ struct kcas_get_cache_param {
|
|||||||
#define KCAS_IOCTL_FLUSH_CORE _IOR(KCAS_IOCTL_MAGIC, 11, struct kcas_flush_core)
|
#define KCAS_IOCTL_FLUSH_CORE _IOR(KCAS_IOCTL_MAGIC, 11, struct kcas_flush_core)
|
||||||
|
|
||||||
/** Retrieving partition status for specified cache id and partition id */
|
/** Retrieving partition status for specified cache id and partition id */
|
||||||
#define KCAS_IOCTL_PARTITION_STATS _IOWR(KCAS_IOCTL_MAGIC, 14, struct kcas_io_class)
|
#define KCAS_IOCTL_PARTITION_INFO _IOWR(KCAS_IOCTL_MAGIC, 14, struct kcas_io_class)
|
||||||
|
|
||||||
/** Configure partitions for specified cache id */
|
/** Configure partitions for specified cache id */
|
||||||
#define KCAS_IOCTL_PARTITION_SET _IOWR(KCAS_IOCTL_MAGIC, 15, struct kcas_io_classes)
|
#define KCAS_IOCTL_PARTITION_SET _IOWR(KCAS_IOCTL_MAGIC, 15, struct kcas_io_classes)
|
||||||
@ -492,6 +505,9 @@ struct kcas_get_cache_param {
|
|||||||
/** Get various cache runtime parameters */
|
/** Get various cache runtime parameters */
|
||||||
#define KCAS_IOCTL_GET_CACHE_PARAM _IOW(KCAS_IOCTL_MAGIC, 33, struct kcas_get_cache_param)
|
#define KCAS_IOCTL_GET_CACHE_PARAM _IOW(KCAS_IOCTL_MAGIC, 33, struct kcas_get_cache_param)
|
||||||
|
|
||||||
|
/** Get stats of particular OCF object */
|
||||||
|
#define KCAS_IOCTL_GET_STATS _IOR(KCAS_IOCTL_MAGIC, 34, struct kcas_get_stats)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extended kernel CAS error codes
|
* Extended kernel CAS error codes
|
||||||
*/
|
*/
|
||||||
|
2
ocf
2
ocf
@ -1 +1 @@
|
|||||||
Subproject commit 9a46c402b2e8398da7a3ee212faf041b3f01f958
|
Subproject commit c2da038c03693a9105bee67952614db1a5cf1a37
|
Loading…
Reference in New Issue
Block a user