The commit is pushed to "branch-rh7-3.10.0-957.12.2.vz7.96.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git after rh7-3.10.0-957.12.2.vz7.96.1 ------> commit 91d12788c16cf8d1b2d956f9ae214de6030ed4ab Author: Pavel Butsykin <pbutsy...@virtuozzo.com> Date: Tue May 21 18:51:26 2019 +0300
fs/fuse kio: implement cs_stats statistics info This statistic shows information about all cs's, directed to show how much and what type of load the chunk servers are loaded on. Made by analogy with .vstorage.info/cs_stats statistics of user-mod client. Signed-off-by: Pavel Butsykin <pbutsy...@virtuozzo.com> ===================== Patchset description: Statistics for vstorage kernel fast-path Vstorage provides plenty of statistics information via 'vstorage -c cl mnt-top', but when it comes kernel fast-path, it doesn't work. All because mnt-top command collects information from .vstorage.info directory, where vstorage-mount provides a lot of different statistical information in the form of files, but it was not implemented for for fast-path. This patch-set is aimed to implementation of the support of some statistics inforamtion files from .vstorage.info: cs_stats fstat fstat_lat iostat requests Which will be located at "/sys/fs/fuse/connections/*mnt_id*/kio_stat/". This will be enough to maintain vstorage mnt-top command for fast-path mount points. https://pmc.acronis.com/browse/VSTOR-20979 Pavel Butsykin (15): fs/fuse: add conn_ctl to fuse_conn struct fs/fuse kio: create sysfs stat directory fs/fuse kio: implement iostat fs/fuse kio: make common interface pcs_kio_file_list() for listing kio files fs/fuse kio: make common interface pcs_kio_req_list() for listing kio reqs fs/fuse kio: add retry counter for kio requests fs/fuse kio: implement pcs_strerror() fs/fuse kio: implement requests statistics fs/fuse kio: implement fstat statistics info fs/fuse kio: implement fstat_lat statistics info fs/fuse kio: remove useless pcs_cs initialization fs/fuse kio: implement cs statistics accounting fs/fuse kio: convert rpc state id to string fs/fuse kio: implement cs_stats statistics info fs/fuse kio: add locked cs_get_avg_in_flight() --- fs/fuse/kio/pcs/fuse_stat.c | 73 +++++++++++++++++++++++++++++++++++++++++++++ fs/fuse/kio/pcs/fuse_stat.h | 1 + 2 files changed, 74 insertions(+) diff --git a/fs/fuse/kio/pcs/fuse_stat.c b/fs/fuse/kio/pcs/fuse_stat.c index 452bb4e9664c..edb124a00682 100644 --- a/fs/fuse/kio/pcs/fuse_stat.c +++ b/fs/fuse/kio/pcs/fuse_stat.c @@ -133,6 +133,71 @@ static inline unsigned long long fuse_val_cnt_max(struct fuse_val_cnt const* c) #define CNT_MIN(c) fuse_val_cnt_min(&(c)) #define CNT_MAX(c) fuse_val_cnt_max(&(c)) +static int do_show_cs_stats(struct pcs_cs *cs, void *ctx) +{ + struct seq_file *m = ctx; + int rpc_state = cs->rpc ? cs->rpc->state : PCS_RPC_UNCONN; + unsigned int in_flight_avg = 0; /* TODO */ + struct pcs_perf_stat_cnt iolat, netlat; + struct pcs_perf_rate_cnt read_ops_rate, write_ops_rate, sync_ops_rate; + + spin_lock(&cs->stat.lock); + iolat = cs->stat.iolat; + netlat = cs->stat.netlat; + read_ops_rate = cs->stat.read_ops_rate; + write_ops_rate = cs->stat.write_ops_rate; + sync_ops_rate = cs->stat.sync_ops_rate; + spin_unlock(&cs->stat.lock); + + seq_printf(m, "%-10llu %d=%-8s %-10llu %-10llu %-10llu %-12llu %-12llu %-12llu %-12llu %-10u\n", + NODE_ARGS(cs->id), rpc_state, pcs_rpc_state_name(rpc_state), + read_ops_rate.rate / STAT_TIMER_PERIOD, + write_ops_rate.rate / STAT_TIMER_PERIOD, + sync_ops_rate.rate / STAT_TIMER_PERIOD, + netlat.avg, pcs_perfcounter_stat_max(&netlat), + iolat.avg, pcs_perfcounter_stat_max(&iolat), + in_flight_avg); + return 0; +} + +static int pcs_fuse_cs_stats_show(struct seq_file *m, void *v) +{ + struct inode *inode = m->private; + struct pcs_cluster_core *cc; + struct pcs_fuse_stat *stat; + + if (!inode) + return 0; + + mutex_lock(&fuse_mutex); + stat = inode->i_private; + if (!stat) { + mutex_unlock(&fuse_mutex); + return 0; + } + + seq_printf(m, "# csid rpc rd_ops wr_ops sync_ops net_lat_avg net_lat_max io_lat_avg io_lat_max avg_in_flight\n"); + + cc = container_of(stat, struct pcs_cluster_core, stat); + pcs_cs_for_each_entry(&cc->css, do_show_cs_stats, m); + + mutex_unlock(&fuse_mutex); + + return 0; +} + +static int pcs_fuse_cs_stats_open(struct inode *inode, struct file *file) +{ + return single_open(file, pcs_fuse_cs_stats_show, inode); +} + +static const struct file_operations pcs_fuse_cs_stats_ops = { + .owner = THIS_MODULE, + .open = pcs_fuse_cs_stats_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; #define MAX_PERCENT 100 static int latency_npercl_format(struct fuse_lat_stat *s, u8 percl, char *buf, @@ -528,6 +593,8 @@ static void pcs_fuse_stat_work(struct work_struct *w) pcs_fuse_stat_files_up(cc); + pcs_cs_set_stat_up(&cc->css); + mod_delayed_work(cc->wq, &cc->stat.work, STAT_TIMER_PERIOD * HZ); } @@ -615,6 +682,10 @@ void pcs_fuse_stat_init(struct pcs_fuse_stat *stat) stat->fstat_lat = fuse_kio_add_dentry(stat->kio_stat, fc, "fstat_lat", S_IFREG | S_IRUSR, 1, NULL, &pcs_fuse_fstat_lat_ops, stat); + + stat->cs_stats = fuse_kio_add_dentry(stat->kio_stat, fc, "cs_stats", + S_IFREG | S_IRUSR, 1, NULL, + &pcs_fuse_cs_stats_ops, stat); out: mutex_unlock(&fuse_mutex); } @@ -634,6 +705,8 @@ void pcs_fuse_stat_fini(struct pcs_fuse_stat *stat) fuse_kio_rm_dentry(stat->fstat); if (stat->fstat_lat) fuse_kio_rm_dentry(stat->fstat_lat); + if (stat->cs_stats) + fuse_kio_rm_dentry(stat->cs_stats); fuse_kio_rm_dentry(stat->kio_stat); } mutex_unlock(&fuse_mutex); diff --git a/fs/fuse/kio/pcs/fuse_stat.h b/fs/fuse/kio/pcs/fuse_stat.h index 32971cf77dc4..88033c0eecc5 100644 --- a/fs/fuse/kio/pcs/fuse_stat.h +++ b/fs/fuse/kio/pcs/fuse_stat.h @@ -35,6 +35,7 @@ struct pcs_fuse_stat { struct dentry *requests; struct dentry *fstat; struct dentry *fstat_lat; + struct dentry *cs_stats; }; enum { _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel