[Devel] [PATCH RHEL7 COMMIT] fs/fuse kio: convert rpc state id to string

Konstantin Khorenko khorenko at virtuozzo.com
Tue May 21 18:51:28 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 13e366d80c0880eb663961d9d648d24d1a4ee9de
Author: Pavel Butsykin <pbutsykin at virtuozzo.com>
Date:   Tue May 21 18:51:26 2019 +0300

    fs/fuse kio: convert rpc state id to string
    
    This is preparation patch that will be needed to display the rpc state
    as string.
    
    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/pcs_rpc.c | 23 +++++++++++++++++++++++
 fs/fuse/kio/pcs/pcs_rpc.h |  2 ++
 2 files changed, 25 insertions(+)

diff --git a/fs/fuse/kio/pcs/pcs_rpc.c b/fs/fuse/kio/pcs/pcs_rpc.c
index a34b204476bd..66d090988552 100644
--- a/fs/fuse/kio/pcs/pcs_rpc.c
+++ b/fs/fuse/kio/pcs/pcs_rpc.c
@@ -1434,3 +1434,26 @@ void rpc_connect_done(struct pcs_rpc *ep, struct socket *sock)
 	mutex_unlock(&ep->mutex);
 
 }
+
+static const char *s_rpc_state_names[] = {
+	[PCS_RPC_UNCONN]	= "UNCONN",	/* Not connected */
+	[PCS_RPC_CONNECT]	= "CONNECT",	/* Connect in progress */
+	[PCS_RPC_AUTH]		= "AUTH",	/* Connected. Auth request sent. */
+	[PCS_RPC_AUTHWAIT]	= "AUTHWAIT",	/* Accepted. Waiting for auth request from peer. */
+	[PCS_RPC_APPWAIT] 	= "APPWAIT",	/* Auth complete, client is notified */
+	[PCS_RPC_WORK]		= "WORK",	/* Established */
+	[PCS_RPC_HOLDDOWN] 	= "HOLDDOWN",	/* Not connected. Connect must not be reinitiated. */
+	[PCS_RPC_ABORT]		= "ABORT",	/* Aborted. Not reconnected automatically. */
+	[PCS_RPC_DESTROY]	= "DESTROY"	/* Destruction in progress */
+};
+
+const char *pcs_rpc_state_name(unsigned state)
+{
+	const char *name;
+	if (state >=  ARRAY_SIZE(s_rpc_state_names))
+		return "Invalid";
+	name = s_rpc_state_names[state];
+	if (!name)
+		return "Invalid";
+	return name;
+}
diff --git a/fs/fuse/kio/pcs/pcs_rpc.h b/fs/fuse/kio/pcs/pcs_rpc.h
index 8d3c571fd1e2..119de48d4376 100644
--- a/fs/fuse/kio/pcs/pcs_rpc.h
+++ b/fs/fuse/kio/pcs/pcs_rpc.h
@@ -292,4 +292,6 @@ static inline struct pcs_rpc *pcs_rpc_from_work(struct work_struct *wr)
 	return container_of(wr, struct pcs_rpc, work);
 }
 
+const char* pcs_rpc_state_name(unsigned state);
+
 #endif /* _PCS_RPC_H_ */



More information about the Devel mailing list