New ioctl for retriveing ocf stats.
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
parent
bda0eb41a9
commit
4726bedb50
@ -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;
|
||||||
|
@ -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);
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
@ -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;
|
||||||
@ -405,6 +427,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 *
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -492,6 +515,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