[Devel] [PATCH RHEL7 COMMIT] fs/fuse kio: add locked cs_get_avg_in_flight()

Konstantin Khorenko khorenko at virtuozzo.com
Tue May 21 18:51:29 MSK 2019


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 53915acab838c69fddca178f6c6cd47c4e6d92ed
Author: Pavel Butsykin <pbutsykin at virtuozzo.com>
Date:   Tue May 21 18:51:27 2019 +0300

    fs/fuse kio: add locked cs_get_avg_in_flight()
    
    This function is needed to display in_flight_avg metrics for cs statistics in
    cs unlocked context.
    
    Signed-off-by: Pavel Butsykin <pbutsykin at 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 |  2 +-
 fs/fuse/kio/pcs/pcs_cs.c    | 11 +++++++++++
 fs/fuse/kio/pcs/pcs_cs.h    |  1 +
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/fs/fuse/kio/pcs/fuse_stat.c b/fs/fuse/kio/pcs/fuse_stat.c
index edb124a00682..1cf14bcc0073 100644
--- a/fs/fuse/kio/pcs/fuse_stat.c
+++ b/fs/fuse/kio/pcs/fuse_stat.c
@@ -137,7 +137,7 @@ 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 */
+	unsigned int in_flight_avg = cs_get_avg_in_flight_lock(cs);
 	struct pcs_perf_stat_cnt iolat, netlat;
 	struct pcs_perf_rate_cnt read_ops_rate, write_ops_rate, sync_ops_rate;
 
diff --git a/fs/fuse/kio/pcs/pcs_cs.c b/fs/fuse/kio/pcs/pcs_cs.c
index 6293a242bd24..585c8d93e1eb 100644
--- a/fs/fuse/kio/pcs/pcs_cs.c
+++ b/fs/fuse/kio/pcs/pcs_cs.c
@@ -909,6 +909,17 @@ unsigned int cs_get_avg_in_flight(struct pcs_cs *cs)
 	return cs->in_flight_avg;
 }
 
+unsigned int cs_get_avg_in_flight_lock(struct pcs_cs *cs)
+{
+	unsigned int in_flight_avg;
+
+	spin_lock(&cs->lock);
+	in_flight_avg = cs_get_avg_in_flight(cs);
+	spin_unlock(&cs->lock);
+
+	return in_flight_avg;
+}
+
 void cs_increment_in_flight(struct pcs_cs *cs, unsigned int to_add)
 {
 	unsigned int avg;
diff --git a/fs/fuse/kio/pcs/pcs_cs.h b/fs/fuse/kio/pcs/pcs_cs.h
index bdf93d75d944..dea42d8f8f06 100644
--- a/fs/fuse/kio/pcs/pcs_cs.h
+++ b/fs/fuse/kio/pcs/pcs_cs.h
@@ -146,6 +146,7 @@ void cs_increment_in_flight(struct pcs_cs *cs, unsigned int to_add);
 void cs_decrement_in_flight(struct pcs_cs *cs, unsigned int to_dec);
 void cs_cwnd_use_or_lose(struct pcs_cs *cs);
 unsigned int cs_get_avg_in_flight(struct pcs_cs *cs);
+unsigned int cs_get_avg_in_flight_lock(struct pcs_cs *cs);
 
 void pcs_csset_init(struct pcs_cs_set *css);
 void pcs_csset_fini(struct pcs_cs_set *css);



More information about the Devel mailing list