All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] NFS: include filelayout DS rpc stats in mountstats
@ 2012-02-09 16:41 Weston Andros Adamson
  2012-02-09 16:49 ` Chuck Lever
  2012-02-09 18:16 ` Myklebust, Trond
  0 siblings, 2 replies; 23+ messages in thread
From: Weston Andros Adamson @ 2012-02-09 16:41 UTC (permalink / raw)
  To: Trond.Myklebust, chuck.lever; +Cc: linux-nfs, Weston Andros Adamson

Include RPC statistics from all data servers in /proc/self/mountstats for pNFS
filelayout mounts.

The additional info printed on the "per-op statistics" line does not break
current mountstats(8) from nfs-utils.

Signed-off-by: Weston Andros Adamson <dros@netapp.com>
---

This is clearly a better approach than I was taking trying to keep DS rpc stats
separate in /proc/self/mountstats.

FYI, there are no other callers of rpc_print_iostats().

The new output of /proc/self/mountstats works fine with current mountstats 
userland tool.  The additional data on the per-op statistics line doesn't make
it into the output, but I left it in /proc/self/mountstats because it doesn't
break anything and can be included in newer versions of mountstats.

I plan on adding the per-DS stats (rpc and others) somewhere in /proc/fs/nfsfs/
soon.

 fs/nfs/nfs4filelayout.c        |   30 ++++++++++++++++++++++++++
 fs/nfs/pnfs.h                  |   23 ++++++++++++++++++++
 fs/nfs/pnfs_dev.c              |   45 ++++++++++++++++++++++++++++++++++++++++
 fs/nfs/super.c                 |    3 +-
 include/linux/sunrpc/metrics.h |   13 +++++++++-
 net/sunrpc/stats.c             |   38 ++++++++++++++++++++++++++++++++-
 6 files changed, 147 insertions(+), 5 deletions(-)

diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index 79be7ac..51c71e5 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -33,6 +33,8 @@
 #include <linux/nfs_page.h>
 #include <linux/module.h>
 
+#include <linux/sunrpc/metrics.h>
+
 #include "internal.h"
 #include "nfs4filelayout.h"
 
@@ -918,6 +920,33 @@ filelayout_free_deveiceid_node(struct nfs4_deviceid_node *d)
 	nfs4_fl_free_deviceid(container_of(d, struct nfs4_file_layout_dsaddr, id_node));
 }
 
+static unsigned int
+filelayout_rpc_add_iostats(struct rpc_iostats *total,
+			   unsigned int maxproc,
+			   struct nfs4_deviceid_node *d)
+{
+	struct nfs4_file_layout_dsaddr *dsaddr;
+	struct nfs4_pnfs_ds *ds;
+	unsigned int num_ds = 0;
+	u32 i;
+
+	dsaddr = container_of(d, struct nfs4_file_layout_dsaddr, id_node);
+
+	for (i = 0; i < dsaddr->ds_num; i++) {
+		ds = dsaddr->ds_list[i];
+
+		/* only add iostats if nfs_client is different from MDS */
+		if (ds && ds->ds_clp && d->nfs_client != ds->ds_clp) {
+			struct rpc_clnt *clnt = ds->ds_clp->cl_rpcclient;
+			rpc_add_iostats(total, clnt->cl_metrics,
+					min(maxproc, clnt->cl_maxproc));
+			num_ds++;
+		}
+	}
+
+	return num_ds;
+}
+
 static struct pnfs_layoutdriver_type filelayout_type = {
 	.id			= LAYOUT_NFSV4_1_FILES,
 	.name			= "LAYOUT_NFSV4_1_FILES",
@@ -932,6 +961,7 @@ static struct pnfs_layoutdriver_type filelayout_type = {
 	.read_pagelist		= filelayout_read_pagelist,
 	.write_pagelist		= filelayout_write_pagelist,
 	.free_deviceid_node	= filelayout_free_deveiceid_node,
+	.ds_rpc_add_iostats	= filelayout_rpc_add_iostats,
 };
 
 static int __init nfs4filelayout_init(void)
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index 53d593a..d1b82eb 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -72,6 +72,7 @@ enum layoutdriver_policy_flags {
 };
 
 struct nfs4_deviceid_node;
+struct rpc_iostats;
 
 /* Per-layout driver specific registration structure */
 struct pnfs_layoutdriver_type {
@@ -119,6 +120,9 @@ struct pnfs_layoutdriver_type {
 	void (*encode_layoutcommit) (struct pnfs_layout_hdr *layoutid,
 				     struct xdr_stream *xdr,
 				     const struct nfs4_layoutcommit_args *args);
+
+	unsigned int (*ds_rpc_add_iostats) (struct rpc_iostats *, unsigned int,
+					    struct nfs4_deviceid_node *);
 };
 
 struct pnfs_layout_hdr {
@@ -239,6 +243,10 @@ void nfs4_init_deviceid_node(struct nfs4_deviceid_node *,
 struct nfs4_deviceid_node *nfs4_insert_deviceid_node(struct nfs4_deviceid_node *);
 bool nfs4_put_deviceid_node(struct nfs4_deviceid_node *);
 void nfs4_deviceid_purge_client(const struct nfs_client *);
+void nfs4_deviceid_rpc_print_iostats(struct seq_file *seq,
+				     const struct nfs_client *clp,
+				     const struct pnfs_layoutdriver_type *ld);
+
 
 static inline int lo_fail_bit(u32 iomode)
 {
@@ -328,6 +336,15 @@ static inline int pnfs_return_layout(struct inode *ino)
 	return 0;
 }
 
+static inline int
+pnfs_rpc_print_iostats(struct seq_file *m, struct nfs_server *nfss)
+{
+	if (!pnfs_enabled_sb(nfss))
+		return 0;
+	nfs4_deviceid_rpc_print_iostats(m, nfss->nfs_client,
+					nfss->pnfs_curr_ld);
+	return 1;
+}
 #else  /* CONFIG_NFS_V4_1 */
 
 static inline void pnfs_destroy_all_layouts(struct nfs_client *clp)
@@ -429,6 +446,12 @@ static inline int pnfs_layoutcommit_inode(struct inode *inode, bool sync)
 static inline void nfs4_deviceid_purge_client(struct nfs_client *ncl)
 {
 }
+
+static inline void
+pnfs_rpc_print_iostats(struct seq_file *m, struct nfs_server *nfss)
+{
+	return 0;
+}
 #endif /* CONFIG_NFS_V4_1 */
 
 #endif /* FS_NFS_PNFS_H */
diff --git a/fs/nfs/pnfs_dev.c b/fs/nfs/pnfs_dev.c
index 4f359d2..aa5d102 100644
--- a/fs/nfs/pnfs_dev.c
+++ b/fs/nfs/pnfs_dev.c
@@ -29,6 +29,9 @@
  */
 
 #include <linux/export.h>
+
+#include <linux/sunrpc/metrics.h>
+
 #include "pnfs.h"
 
 #define NFSDBG_FACILITY		NFSDBG_PNFS
@@ -115,6 +118,48 @@ nfs4_find_get_deviceid(const struct pnfs_layoutdriver_type *ld,
 }
 EXPORT_SYMBOL_GPL(nfs4_find_get_deviceid);
 
+
+void
+nfs4_deviceid_rpc_print_iostats(struct seq_file *seq,
+				const struct nfs_client *clp,
+				const struct pnfs_layoutdriver_type *ld)
+{
+	struct nfs4_deviceid_node *d;
+	struct hlist_node *n;
+	struct rpc_iostats *totals;
+	char msgbuf[64];
+	unsigned int num_ds = 0;
+	unsigned int maxproc;
+	long h;
+
+	if (!ld->ds_rpc_add_iostats)
+		return;
+	totals = rpc_alloc_iostats(clp->cl_rpcclient);
+	if (!totals)
+		return;
+	maxproc = clp->cl_rpcclient->cl_maxproc;
+	rpc_add_iostats(totals, clp->cl_rpcclient->cl_metrics, maxproc);
+
+	rcu_read_lock();
+	for (h = 0; h < NFS4_DEVICE_ID_HASH_SIZE; h++) {
+		hlist_for_each_entry_rcu(d, n, &nfs4_deviceid_cache[h], node) {
+			if (d->ld == ld && d->nfs_client == clp) {
+				if (atomic_read(&d->ref))
+					num_ds += ld->ds_rpc_add_iostats(totals,
+							maxproc, d);
+			}
+		}
+	}
+	rcu_read_unlock();
+
+	snprintf(msgbuf, sizeof(msgbuf),
+		 " for the metadata server and %u data server%s", num_ds,
+		 (num_ds != 1) ? "s" : "");
+	rpc_print_iostats(seq, clp->cl_rpcclient, totals, msgbuf);
+	rpc_free_iostats(totals);
+}
+EXPORT_SYMBOL_GPL(nfs4_deviceid_rpc_print_iostats);
+
 /*
  * Remove a deviceid from cache
  *
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index d18a90b..76d0850 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -870,7 +870,8 @@ static int nfs_show_stats(struct seq_file *m, struct dentry *root)
 #endif
 	seq_printf(m, "\n");
 
-	rpc_print_iostats(m, nfss->client);
+	if (!pnfs_rpc_print_iostats(m, nfss))
+		rpc_print_iostats(m, nfss->client, NULL, NULL);
 
 	return 0;
 }
diff --git a/include/linux/sunrpc/metrics.h b/include/linux/sunrpc/metrics.h
index b6edbc0..e6e04e4 100644
--- a/include/linux/sunrpc/metrics.h
+++ b/include/linux/sunrpc/metrics.h
@@ -75,14 +75,23 @@ struct rpc_clnt;
 
 struct rpc_iostats *	rpc_alloc_iostats(struct rpc_clnt *);
 void			rpc_count_iostats(struct rpc_task *);
-void			rpc_print_iostats(struct seq_file *, struct rpc_clnt *);
+void			rpc_print_iostats(struct seq_file *,
+					  struct rpc_clnt *,
+					  struct rpc_iostats *,
+					  const char *);
+void			rpc_add_iostats(struct rpc_iostats *,
+					struct rpc_iostats *, unsigned int);
 void			rpc_free_iostats(struct rpc_iostats *);
 
 #else  /*  CONFIG_PROC_FS  */
 
 static inline struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt) { return NULL; }
 static inline void rpc_count_iostats(struct rpc_task *task) {}
-static inline void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt) {}
+static inline void rpc_print_iostats(struct seq_file *seq,
+				     struct rpc_iostats *stat) {}
+static inline void rpc_add_iostats(struct rpc_iostats *total,
+				   struct rpc_iostats *new,
+				   unsigned int maxproc) {}
 static inline void rpc_free_iostats(struct rpc_iostats *stats) {}
 
 #endif  /*  CONFIG_PROC_FS  */
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c
index 3c4f688..342df57 100644
--- a/net/sunrpc/stats.c
+++ b/net/sunrpc/stats.c
@@ -176,12 +176,16 @@ static void _print_name(struct seq_file *seq, unsigned int op,
 		seq_printf(seq, "\t%12u: ", op);
 }
 
-void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt)
+void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt,
+		       struct rpc_iostats *altstats,
+		       const char *altstats_msg)
 {
 	struct rpc_iostats *stats = clnt->cl_metrics;
 	struct rpc_xprt *xprt = clnt->cl_xprt;
 	unsigned int op, maxproc = clnt->cl_maxproc;
 
+	if (altstats)
+		stats = altstats;
 	if (!stats)
 		return;
 
@@ -192,7 +196,8 @@ void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt)
 	if (xprt)
 		xprt->ops->print_stats(xprt, seq);
 
-	seq_printf(seq, "\tper-op statistics\n");
+	seq_printf(seq, "\tper-op statistics%s\n",
+		   (altstats && altstats_msg) ? altstats_msg : "");
 	for (op = 0; op < maxproc; op++) {
 		struct rpc_iostats *metrics = &stats[op];
 		_print_name(seq, op, clnt->cl_procinfo);
@@ -209,6 +214,35 @@ void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt)
 }
 EXPORT_SYMBOL_GPL(rpc_print_iostats);
 
+void
+rpc_add_iostats(struct rpc_iostats *totals, struct rpc_iostats *new,
+		unsigned int maxproc)
+{
+	unsigned int op;
+
+	for (op = 0; op < maxproc; op++) {
+		struct rpc_iostats *op_totals = &totals[op],
+				   *op_new = &new[op];
+
+		op_totals->om_ops += op_new->om_ops;
+		op_totals->om_ntrans += op_new->om_ntrans;
+		op_totals->om_timeouts += op_new->om_timeouts;
+
+		op_totals->om_bytes_sent += op_new->om_bytes_sent;
+		op_totals->om_bytes_recv += op_new->om_bytes_recv;
+
+		op_totals->om_queue = ktime_add(op_totals->om_queue,
+					       op_new->om_queue);
+
+		op_totals->om_rtt = ktime_add(op_totals->om_rtt,
+					      op_new->om_rtt);
+
+		op_totals->om_execute = ktime_add(op_totals->om_execute,
+						 op_new->om_execute);
+	}
+}
+EXPORT_SYMBOL_GPL(rpc_add_iostats);
+
 /*
  * Register/unregister RPC proc files
  */
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH] NFS: include filelayout DS rpc stats in mountstats
  2012-02-09 16:41 [PATCH] NFS: include filelayout DS rpc stats in mountstats Weston Andros Adamson
@ 2012-02-09 16:49 ` Chuck Lever
  2012-02-09 16:59   ` Adamson, Dros
  2012-02-09 18:16 ` Myklebust, Trond
  1 sibling, 1 reply; 23+ messages in thread
From: Chuck Lever @ 2012-02-09 16:49 UTC (permalink / raw)
  To: Weston Andros Adamson; +Cc: Trond.Myklebust, linux-nfs


On Feb 9, 2012, at 11:41 AM, Weston Andros Adamson wrote:

> Include RPC statistics from all data servers in /proc/self/mountstats for pNFS
> filelayout mounts.
> 
> The additional info printed on the "per-op statistics" line does not break
> current mountstats(8) from nfs-utils.
> 
> Signed-off-by: Weston Andros Adamson <dros@netapp.com>
> ---
> 
> This is clearly a better approach than I was taking trying to keep DS rpc stats
> separate in /proc/self/mountstats.

I guess you could argue that since these are "mount" stats, it's a per mount point thing, not necessarily a per server thing.  We've simply had it that way because prior to pNFS, you couldn't have more than one server per mount point.

At some point we might consider also displaying some fs_locations data here, and perhaps a count of how many migration or replication failover events have been seen.  For another day.

> FYI, there are no other callers of rpc_print_iostats().
> 
> The new output of /proc/self/mountstats works fine with current mountstats 
> userland tool.  The additional data on the per-op statistics line doesn't make
> it into the output, but I left it in /proc/self/mountstats because it doesn't
> break anything and can be included in newer versions of mountstats.
> 
> I plan on adding the per-DS stats (rpc and others) somewhere in /proc/fs/nfsfs/
> soon.
> 
> fs/nfs/nfs4filelayout.c        |   30 ++++++++++++++++++++++++++
> fs/nfs/pnfs.h                  |   23 ++++++++++++++++++++
> fs/nfs/pnfs_dev.c              |   45 ++++++++++++++++++++++++++++++++++++++++
> fs/nfs/super.c                 |    3 +-
> include/linux/sunrpc/metrics.h |   13 +++++++++-
> net/sunrpc/stats.c             |   38 ++++++++++++++++++++++++++++++++-
> 6 files changed, 147 insertions(+), 5 deletions(-)
> 
> diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
> index 79be7ac..51c71e5 100644
> --- a/fs/nfs/nfs4filelayout.c
> +++ b/fs/nfs/nfs4filelayout.c
> @@ -33,6 +33,8 @@
> #include <linux/nfs_page.h>
> #include <linux/module.h>
> 
> +#include <linux/sunrpc/metrics.h>
> +
> #include "internal.h"
> #include "nfs4filelayout.h"
> 
> @@ -918,6 +920,33 @@ filelayout_free_deveiceid_node(struct nfs4_deviceid_node *d)
> 	nfs4_fl_free_deviceid(container_of(d, struct nfs4_file_layout_dsaddr, id_node));
> }
> 
> +static unsigned int
> +filelayout_rpc_add_iostats(struct rpc_iostats *total,
> +			   unsigned int maxproc,
> +			   struct nfs4_deviceid_node *d)
> +{
> +	struct nfs4_file_layout_dsaddr *dsaddr;
> +	struct nfs4_pnfs_ds *ds;
> +	unsigned int num_ds = 0;
> +	u32 i;
> +
> +	dsaddr = container_of(d, struct nfs4_file_layout_dsaddr, id_node);
> +
> +	for (i = 0; i < dsaddr->ds_num; i++) {
> +		ds = dsaddr->ds_list[i];
> +
> +		/* only add iostats if nfs_client is different from MDS */
> +		if (ds && ds->ds_clp && d->nfs_client != ds->ds_clp) {
> +			struct rpc_clnt *clnt = ds->ds_clp->cl_rpcclient;
> +			rpc_add_iostats(total, clnt->cl_metrics,
> +					min(maxproc, clnt->cl_maxproc));
> +			num_ds++;
> +		}
> +	}
> +
> +	return num_ds;
> +}
> +
> static struct pnfs_layoutdriver_type filelayout_type = {
> 	.id			= LAYOUT_NFSV4_1_FILES,
> 	.name			= "LAYOUT_NFSV4_1_FILES",
> @@ -932,6 +961,7 @@ static struct pnfs_layoutdriver_type filelayout_type = {
> 	.read_pagelist		= filelayout_read_pagelist,
> 	.write_pagelist		= filelayout_write_pagelist,
> 	.free_deviceid_node	= filelayout_free_deveiceid_node,
> +	.ds_rpc_add_iostats	= filelayout_rpc_add_iostats,
> };
> 
> static int __init nfs4filelayout_init(void)
> diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
> index 53d593a..d1b82eb 100644
> --- a/fs/nfs/pnfs.h
> +++ b/fs/nfs/pnfs.h
> @@ -72,6 +72,7 @@ enum layoutdriver_policy_flags {
> };
> 
> struct nfs4_deviceid_node;
> +struct rpc_iostats;
> 
> /* Per-layout driver specific registration structure */
> struct pnfs_layoutdriver_type {
> @@ -119,6 +120,9 @@ struct pnfs_layoutdriver_type {
> 	void (*encode_layoutcommit) (struct pnfs_layout_hdr *layoutid,
> 				     struct xdr_stream *xdr,
> 				     const struct nfs4_layoutcommit_args *args);
> +
> +	unsigned int (*ds_rpc_add_iostats) (struct rpc_iostats *, unsigned int,
> +					    struct nfs4_deviceid_node *);
> };
> 
> struct pnfs_layout_hdr {
> @@ -239,6 +243,10 @@ void nfs4_init_deviceid_node(struct nfs4_deviceid_node *,
> struct nfs4_deviceid_node *nfs4_insert_deviceid_node(struct nfs4_deviceid_node *);
> bool nfs4_put_deviceid_node(struct nfs4_deviceid_node *);
> void nfs4_deviceid_purge_client(const struct nfs_client *);
> +void nfs4_deviceid_rpc_print_iostats(struct seq_file *seq,
> +				     const struct nfs_client *clp,
> +				     const struct pnfs_layoutdriver_type *ld);
> +
> 
> static inline int lo_fail_bit(u32 iomode)
> {
> @@ -328,6 +336,15 @@ static inline int pnfs_return_layout(struct inode *ino)
> 	return 0;
> }
> 
> +static inline int
> +pnfs_rpc_print_iostats(struct seq_file *m, struct nfs_server *nfss)
> +{
> +	if (!pnfs_enabled_sb(nfss))
> +		return 0;
> +	nfs4_deviceid_rpc_print_iostats(m, nfss->nfs_client,
> +					nfss->pnfs_curr_ld);
> +	return 1;
> +}
> #else  /* CONFIG_NFS_V4_1 */
> 
> static inline void pnfs_destroy_all_layouts(struct nfs_client *clp)
> @@ -429,6 +446,12 @@ static inline int pnfs_layoutcommit_inode(struct inode *inode, bool sync)
> static inline void nfs4_deviceid_purge_client(struct nfs_client *ncl)
> {
> }
> +
> +static inline void
> +pnfs_rpc_print_iostats(struct seq_file *m, struct nfs_server *nfss)
> +{
> +	return 0;
> +}
> #endif /* CONFIG_NFS_V4_1 */
> 
> #endif /* FS_NFS_PNFS_H */
> diff --git a/fs/nfs/pnfs_dev.c b/fs/nfs/pnfs_dev.c
> index 4f359d2..aa5d102 100644
> --- a/fs/nfs/pnfs_dev.c
> +++ b/fs/nfs/pnfs_dev.c
> @@ -29,6 +29,9 @@
>  */
> 
> #include <linux/export.h>
> +
> +#include <linux/sunrpc/metrics.h>
> +
> #include "pnfs.h"
> 
> #define NFSDBG_FACILITY		NFSDBG_PNFS
> @@ -115,6 +118,48 @@ nfs4_find_get_deviceid(const struct pnfs_layoutdriver_type *ld,
> }
> EXPORT_SYMBOL_GPL(nfs4_find_get_deviceid);
> 
> +
> +void
> +nfs4_deviceid_rpc_print_iostats(struct seq_file *seq,
> +				const struct nfs_client *clp,
> +				const struct pnfs_layoutdriver_type *ld)
> +{
> +	struct nfs4_deviceid_node *d;
> +	struct hlist_node *n;
> +	struct rpc_iostats *totals;
> +	char msgbuf[64];
> +	unsigned int num_ds = 0;
> +	unsigned int maxproc;
> +	long h;
> +
> +	if (!ld->ds_rpc_add_iostats)
> +		return;
> +	totals = rpc_alloc_iostats(clp->cl_rpcclient);
> +	if (!totals)
> +		return;
> +	maxproc = clp->cl_rpcclient->cl_maxproc;
> +	rpc_add_iostats(totals, clp->cl_rpcclient->cl_metrics, maxproc);
> +
> +	rcu_read_lock();
> +	for (h = 0; h < NFS4_DEVICE_ID_HASH_SIZE; h++) {
> +		hlist_for_each_entry_rcu(d, n, &nfs4_deviceid_cache[h], node) {
> +			if (d->ld == ld && d->nfs_client == clp) {
> +				if (atomic_read(&d->ref))
> +					num_ds += ld->ds_rpc_add_iostats(totals,
> +							maxproc, d);
> +			}
> +		}
> +	}
> +	rcu_read_unlock();
> +
> +	snprintf(msgbuf, sizeof(msgbuf),
> +		 " for the metadata server and %u data server%s", num_ds,
> +		 (num_ds != 1) ? "s" : "");
> +	rpc_print_iostats(seq, clp->cl_rpcclient, totals, msgbuf);
> +	rpc_free_iostats(totals);
> +}
> +EXPORT_SYMBOL_GPL(nfs4_deviceid_rpc_print_iostats);
> +
> /*
>  * Remove a deviceid from cache
>  *
> diff --git a/fs/nfs/super.c b/fs/nfs/super.c
> index d18a90b..76d0850 100644
> --- a/fs/nfs/super.c
> +++ b/fs/nfs/super.c
> @@ -870,7 +870,8 @@ static int nfs_show_stats(struct seq_file *m, struct dentry *root)
> #endif
> 	seq_printf(m, "\n");
> 
> -	rpc_print_iostats(m, nfss->client);
> +	if (!pnfs_rpc_print_iostats(m, nfss))
> +		rpc_print_iostats(m, nfss->client, NULL, NULL);
> 
> 	return 0;
> }
> diff --git a/include/linux/sunrpc/metrics.h b/include/linux/sunrpc/metrics.h
> index b6edbc0..e6e04e4 100644
> --- a/include/linux/sunrpc/metrics.h
> +++ b/include/linux/sunrpc/metrics.h
> @@ -75,14 +75,23 @@ struct rpc_clnt;
> 
> struct rpc_iostats *	rpc_alloc_iostats(struct rpc_clnt *);
> void			rpc_count_iostats(struct rpc_task *);
> -void			rpc_print_iostats(struct seq_file *, struct rpc_clnt *);
> +void			rpc_print_iostats(struct seq_file *,
> +					  struct rpc_clnt *,
> +					  struct rpc_iostats *,
> +					  const char *);
> +void			rpc_add_iostats(struct rpc_iostats *,
> +					struct rpc_iostats *, unsigned int);
> void			rpc_free_iostats(struct rpc_iostats *);
> 
> #else  /*  CONFIG_PROC_FS  */
> 
> static inline struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt) { return NULL; }
> static inline void rpc_count_iostats(struct rpc_task *task) {}
> -static inline void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt) {}
> +static inline void rpc_print_iostats(struct seq_file *seq,
> +				     struct rpc_iostats *stat) {}
> +static inline void rpc_add_iostats(struct rpc_iostats *total,
> +				   struct rpc_iostats *new,
> +				   unsigned int maxproc) {}
> static inline void rpc_free_iostats(struct rpc_iostats *stats) {}
> 
> #endif  /*  CONFIG_PROC_FS  */
> diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c
> index 3c4f688..342df57 100644
> --- a/net/sunrpc/stats.c
> +++ b/net/sunrpc/stats.c
> @@ -176,12 +176,16 @@ static void _print_name(struct seq_file *seq, unsigned int op,
> 		seq_printf(seq, "\t%12u: ", op);
> }
> 
> -void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt)
> +void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt,
> +		       struct rpc_iostats *altstats,
> +		       const char *altstats_msg)
> {
> 	struct rpc_iostats *stats = clnt->cl_metrics;
> 	struct rpc_xprt *xprt = clnt->cl_xprt;
> 	unsigned int op, maxproc = clnt->cl_maxproc;
> 
> +	if (altstats)
> +		stats = altstats;
> 	if (!stats)
> 		return;
> 
> @@ -192,7 +196,8 @@ void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt)
> 	if (xprt)
> 		xprt->ops->print_stats(xprt, seq);
> 
> -	seq_printf(seq, "\tper-op statistics\n");
> +	seq_printf(seq, "\tper-op statistics%s\n",
> +		   (altstats && altstats_msg) ? altstats_msg : "");
> 	for (op = 0; op < maxproc; op++) {
> 		struct rpc_iostats *metrics = &stats[op];
> 		_print_name(seq, op, clnt->cl_procinfo);
> @@ -209,6 +214,35 @@ void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt)
> }
> EXPORT_SYMBOL_GPL(rpc_print_iostats);
> 
> +void
> +rpc_add_iostats(struct rpc_iostats *totals, struct rpc_iostats *new,
> +		unsigned int maxproc)
> +{
> +	unsigned int op;
> +
> +	for (op = 0; op < maxproc; op++) {
> +		struct rpc_iostats *op_totals = &totals[op],
> +				   *op_new = &new[op];
> +
> +		op_totals->om_ops += op_new->om_ops;
> +		op_totals->om_ntrans += op_new->om_ntrans;
> +		op_totals->om_timeouts += op_new->om_timeouts;
> +
> +		op_totals->om_bytes_sent += op_new->om_bytes_sent;
> +		op_totals->om_bytes_recv += op_new->om_bytes_recv;
> +
> +		op_totals->om_queue = ktime_add(op_totals->om_queue,
> +					       op_new->om_queue);
> +
> +		op_totals->om_rtt = ktime_add(op_totals->om_rtt,
> +					      op_new->om_rtt);
> +
> +		op_totals->om_execute = ktime_add(op_totals->om_execute,
> +						 op_new->om_execute);
> +	}
> +}
> +EXPORT_SYMBOL_GPL(rpc_add_iostats);
> +
> /*
>  * Register/unregister RPC proc files
>  */
> -- 
> 1.7.4.4
> 

-- 
Chuck Lever
chuck[dot]lever[at]oracle[dot]com





^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] NFS: include filelayout DS rpc stats in mountstats
  2012-02-09 16:49 ` Chuck Lever
@ 2012-02-09 16:59   ` Adamson, Dros
  0 siblings, 0 replies; 23+ messages in thread
From: Adamson, Dros @ 2012-02-09 16:59 UTC (permalink / raw)
  To: Chuck Lever; +Cc: Myklebust, Trond, <linux-nfs@vger.kernel.org>

[-- Attachment #1: Type: text/plain, Size: 12251 bytes --]


On Feb 9, 2012, at 11:49 AM, Chuck Lever wrote:

> 
> On Feb 9, 2012, at 11:41 AM, Weston Andros Adamson wrote:
> 
>> Include RPC statistics from all data servers in /proc/self/mountstats for pNFS
>> filelayout mounts.
>> 
>> The additional info printed on the "per-op statistics" line does not break
>> current mountstats(8) from nfs-utils.
>> 
>> Signed-off-by: Weston Andros Adamson <dros@netapp.com>
>> ---
>> 
>> This is clearly a better approach than I was taking trying to keep DS rpc stats
>> separate in /proc/self/mountstats.
> 
> I guess you could argue that since these are "mount" stats, it's a per mount point thing, not necessarily a per server thing.  We've simply had it that way because prior to pNFS, you couldn't have more than one server per mount point.

Right, Trond made that point to me a while ago :)  

For some reason I was afraid to change the sunrpc metrics interface until I realized that there were no users other than NFS.

> 
> At some point we might consider also displaying some fs_locations data here, and perhaps a count of how many migration or replication failover events have been seen.  For another day.

Agreed.  First we need to fix the statsvers= issue with mountstats(8).  I plan on poking at that today.

> 
>> FYI, there are no other callers of rpc_print_iostats().
>> 
>> The new output of /proc/self/mountstats works fine with current mountstats 
>> userland tool.  The additional data on the per-op statistics line doesn't make
>> it into the output, but I left it in /proc/self/mountstats because it doesn't
>> break anything and can be included in newer versions of mountstats.
>> 
>> I plan on adding the per-DS stats (rpc and others) somewhere in /proc/fs/nfsfs/
>> soon.
>> 
>> fs/nfs/nfs4filelayout.c        |   30 ++++++++++++++++++++++++++
>> fs/nfs/pnfs.h                  |   23 ++++++++++++++++++++
>> fs/nfs/pnfs_dev.c              |   45 ++++++++++++++++++++++++++++++++++++++++
>> fs/nfs/super.c                 |    3 +-
>> include/linux/sunrpc/metrics.h |   13 +++++++++-
>> net/sunrpc/stats.c             |   38 ++++++++++++++++++++++++++++++++-
>> 6 files changed, 147 insertions(+), 5 deletions(-)
>> 
>> diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
>> index 79be7ac..51c71e5 100644
>> --- a/fs/nfs/nfs4filelayout.c
>> +++ b/fs/nfs/nfs4filelayout.c
>> @@ -33,6 +33,8 @@
>> #include <linux/nfs_page.h>
>> #include <linux/module.h>
>> 
>> +#include <linux/sunrpc/metrics.h>
>> +
>> #include "internal.h"
>> #include "nfs4filelayout.h"
>> 
>> @@ -918,6 +920,33 @@ filelayout_free_deveiceid_node(struct nfs4_deviceid_node *d)
>> 	nfs4_fl_free_deviceid(container_of(d, struct nfs4_file_layout_dsaddr, id_node));
>> }
>> 
>> +static unsigned int
>> +filelayout_rpc_add_iostats(struct rpc_iostats *total,
>> +			   unsigned int maxproc,
>> +			   struct nfs4_deviceid_node *d)
>> +{
>> +	struct nfs4_file_layout_dsaddr *dsaddr;
>> +	struct nfs4_pnfs_ds *ds;
>> +	unsigned int num_ds = 0;
>> +	u32 i;
>> +
>> +	dsaddr = container_of(d, struct nfs4_file_layout_dsaddr, id_node);
>> +
>> +	for (i = 0; i < dsaddr->ds_num; i++) {
>> +		ds = dsaddr->ds_list[i];
>> +
>> +		/* only add iostats if nfs_client is different from MDS */
>> +		if (ds && ds->ds_clp && d->nfs_client != ds->ds_clp) {
>> +			struct rpc_clnt *clnt = ds->ds_clp->cl_rpcclient;
>> +			rpc_add_iostats(total, clnt->cl_metrics,
>> +					min(maxproc, clnt->cl_maxproc));
>> +			num_ds++;
>> +		}
>> +	}
>> +
>> +	return num_ds;
>> +}
>> +
>> static struct pnfs_layoutdriver_type filelayout_type = {
>> 	.id			= LAYOUT_NFSV4_1_FILES,
>> 	.name			= "LAYOUT_NFSV4_1_FILES",
>> @@ -932,6 +961,7 @@ static struct pnfs_layoutdriver_type filelayout_type = {
>> 	.read_pagelist		= filelayout_read_pagelist,
>> 	.write_pagelist		= filelayout_write_pagelist,
>> 	.free_deviceid_node	= filelayout_free_deveiceid_node,
>> +	.ds_rpc_add_iostats	= filelayout_rpc_add_iostats,
>> };
>> 
>> static int __init nfs4filelayout_init(void)
>> diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
>> index 53d593a..d1b82eb 100644
>> --- a/fs/nfs/pnfs.h
>> +++ b/fs/nfs/pnfs.h
>> @@ -72,6 +72,7 @@ enum layoutdriver_policy_flags {
>> };
>> 
>> struct nfs4_deviceid_node;
>> +struct rpc_iostats;
>> 
>> /* Per-layout driver specific registration structure */
>> struct pnfs_layoutdriver_type {
>> @@ -119,6 +120,9 @@ struct pnfs_layoutdriver_type {
>> 	void (*encode_layoutcommit) (struct pnfs_layout_hdr *layoutid,
>> 				     struct xdr_stream *xdr,
>> 				     const struct nfs4_layoutcommit_args *args);
>> +
>> +	unsigned int (*ds_rpc_add_iostats) (struct rpc_iostats *, unsigned int,
>> +					    struct nfs4_deviceid_node *);
>> };
>> 
>> struct pnfs_layout_hdr {
>> @@ -239,6 +243,10 @@ void nfs4_init_deviceid_node(struct nfs4_deviceid_node *,
>> struct nfs4_deviceid_node *nfs4_insert_deviceid_node(struct nfs4_deviceid_node *);
>> bool nfs4_put_deviceid_node(struct nfs4_deviceid_node *);
>> void nfs4_deviceid_purge_client(const struct nfs_client *);
>> +void nfs4_deviceid_rpc_print_iostats(struct seq_file *seq,
>> +				     const struct nfs_client *clp,
>> +				     const struct pnfs_layoutdriver_type *ld);
>> +
>> 
>> static inline int lo_fail_bit(u32 iomode)
>> {
>> @@ -328,6 +336,15 @@ static inline int pnfs_return_layout(struct inode *ino)
>> 	return 0;
>> }
>> 
>> +static inline int
>> +pnfs_rpc_print_iostats(struct seq_file *m, struct nfs_server *nfss)
>> +{
>> +	if (!pnfs_enabled_sb(nfss))
>> +		return 0;
>> +	nfs4_deviceid_rpc_print_iostats(m, nfss->nfs_client,
>> +					nfss->pnfs_curr_ld);
>> +	return 1;
>> +}
>> #else  /* CONFIG_NFS_V4_1 */
>> 
>> static inline void pnfs_destroy_all_layouts(struct nfs_client *clp)
>> @@ -429,6 +446,12 @@ static inline int pnfs_layoutcommit_inode(struct inode *inode, bool sync)
>> static inline void nfs4_deviceid_purge_client(struct nfs_client *ncl)
>> {
>> }
>> +
>> +static inline void
>> +pnfs_rpc_print_iostats(struct seq_file *m, struct nfs_server *nfss)
>> +{
>> +	return 0;
>> +}
>> #endif /* CONFIG_NFS_V4_1 */
>> 
>> #endif /* FS_NFS_PNFS_H */
>> diff --git a/fs/nfs/pnfs_dev.c b/fs/nfs/pnfs_dev.c
>> index 4f359d2..aa5d102 100644
>> --- a/fs/nfs/pnfs_dev.c
>> +++ b/fs/nfs/pnfs_dev.c
>> @@ -29,6 +29,9 @@
>> */
>> 
>> #include <linux/export.h>
>> +
>> +#include <linux/sunrpc/metrics.h>
>> +
>> #include "pnfs.h"
>> 
>> #define NFSDBG_FACILITY		NFSDBG_PNFS
>> @@ -115,6 +118,48 @@ nfs4_find_get_deviceid(const struct pnfs_layoutdriver_type *ld,
>> }
>> EXPORT_SYMBOL_GPL(nfs4_find_get_deviceid);
>> 
>> +
>> +void
>> +nfs4_deviceid_rpc_print_iostats(struct seq_file *seq,
>> +				const struct nfs_client *clp,
>> +				const struct pnfs_layoutdriver_type *ld)
>> +{
>> +	struct nfs4_deviceid_node *d;
>> +	struct hlist_node *n;
>> +	struct rpc_iostats *totals;
>> +	char msgbuf[64];
>> +	unsigned int num_ds = 0;
>> +	unsigned int maxproc;
>> +	long h;
>> +
>> +	if (!ld->ds_rpc_add_iostats)
>> +		return;
>> +	totals = rpc_alloc_iostats(clp->cl_rpcclient);
>> +	if (!totals)
>> +		return;
>> +	maxproc = clp->cl_rpcclient->cl_maxproc;
>> +	rpc_add_iostats(totals, clp->cl_rpcclient->cl_metrics, maxproc);
>> +
>> +	rcu_read_lock();
>> +	for (h = 0; h < NFS4_DEVICE_ID_HASH_SIZE; h++) {
>> +		hlist_for_each_entry_rcu(d, n, &nfs4_deviceid_cache[h], node) {
>> +			if (d->ld == ld && d->nfs_client == clp) {
>> +				if (atomic_read(&d->ref))
>> +					num_ds += ld->ds_rpc_add_iostats(totals,
>> +							maxproc, d);
>> +			}
>> +		}
>> +	}
>> +	rcu_read_unlock();
>> +
>> +	snprintf(msgbuf, sizeof(msgbuf),
>> +		 " for the metadata server and %u data server%s", num_ds,
>> +		 (num_ds != 1) ? "s" : "");
>> +	rpc_print_iostats(seq, clp->cl_rpcclient, totals, msgbuf);
>> +	rpc_free_iostats(totals);
>> +}
>> +EXPORT_SYMBOL_GPL(nfs4_deviceid_rpc_print_iostats);
>> +
>> /*
>> * Remove a deviceid from cache
>> *
>> diff --git a/fs/nfs/super.c b/fs/nfs/super.c
>> index d18a90b..76d0850 100644
>> --- a/fs/nfs/super.c
>> +++ b/fs/nfs/super.c
>> @@ -870,7 +870,8 @@ static int nfs_show_stats(struct seq_file *m, struct dentry *root)
>> #endif
>> 	seq_printf(m, "\n");
>> 
>> -	rpc_print_iostats(m, nfss->client);
>> +	if (!pnfs_rpc_print_iostats(m, nfss))
>> +		rpc_print_iostats(m, nfss->client, NULL, NULL);
>> 
>> 	return 0;
>> }
>> diff --git a/include/linux/sunrpc/metrics.h b/include/linux/sunrpc/metrics.h
>> index b6edbc0..e6e04e4 100644
>> --- a/include/linux/sunrpc/metrics.h
>> +++ b/include/linux/sunrpc/metrics.h
>> @@ -75,14 +75,23 @@ struct rpc_clnt;
>> 
>> struct rpc_iostats *	rpc_alloc_iostats(struct rpc_clnt *);
>> void			rpc_count_iostats(struct rpc_task *);
>> -void			rpc_print_iostats(struct seq_file *, struct rpc_clnt *);
>> +void			rpc_print_iostats(struct seq_file *,
>> +					  struct rpc_clnt *,
>> +					  struct rpc_iostats *,
>> +					  const char *);
>> +void			rpc_add_iostats(struct rpc_iostats *,
>> +					struct rpc_iostats *, unsigned int);
>> void			rpc_free_iostats(struct rpc_iostats *);
>> 
>> #else  /*  CONFIG_PROC_FS  */
>> 
>> static inline struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt) { return NULL; }
>> static inline void rpc_count_iostats(struct rpc_task *task) {}
>> -static inline void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt) {}
>> +static inline void rpc_print_iostats(struct seq_file *seq,
>> +				     struct rpc_iostats *stat) {}
>> +static inline void rpc_add_iostats(struct rpc_iostats *total,
>> +				   struct rpc_iostats *new,
>> +				   unsigned int maxproc) {}
>> static inline void rpc_free_iostats(struct rpc_iostats *stats) {}
>> 
>> #endif  /*  CONFIG_PROC_FS  */
>> diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c
>> index 3c4f688..342df57 100644
>> --- a/net/sunrpc/stats.c
>> +++ b/net/sunrpc/stats.c
>> @@ -176,12 +176,16 @@ static void _print_name(struct seq_file *seq, unsigned int op,
>> 		seq_printf(seq, "\t%12u: ", op);
>> }
>> 
>> -void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt)
>> +void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt,
>> +		       struct rpc_iostats *altstats,
>> +		       const char *altstats_msg)
>> {
>> 	struct rpc_iostats *stats = clnt->cl_metrics;
>> 	struct rpc_xprt *xprt = clnt->cl_xprt;
>> 	unsigned int op, maxproc = clnt->cl_maxproc;
>> 
>> +	if (altstats)
>> +		stats = altstats;
>> 	if (!stats)
>> 		return;
>> 
>> @@ -192,7 +196,8 @@ void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt)
>> 	if (xprt)
>> 		xprt->ops->print_stats(xprt, seq);
>> 
>> -	seq_printf(seq, "\tper-op statistics\n");
>> +	seq_printf(seq, "\tper-op statistics%s\n",
>> +		   (altstats && altstats_msg) ? altstats_msg : "");
>> 	for (op = 0; op < maxproc; op++) {
>> 		struct rpc_iostats *metrics = &stats[op];
>> 		_print_name(seq, op, clnt->cl_procinfo);
>> @@ -209,6 +214,35 @@ void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt)
>> }
>> EXPORT_SYMBOL_GPL(rpc_print_iostats);
>> 
>> +void
>> +rpc_add_iostats(struct rpc_iostats *totals, struct rpc_iostats *new,
>> +		unsigned int maxproc)
>> +{
>> +	unsigned int op;
>> +
>> +	for (op = 0; op < maxproc; op++) {
>> +		struct rpc_iostats *op_totals = &totals[op],
>> +				   *op_new = &new[op];
>> +
>> +		op_totals->om_ops += op_new->om_ops;
>> +		op_totals->om_ntrans += op_new->om_ntrans;
>> +		op_totals->om_timeouts += op_new->om_timeouts;
>> +
>> +		op_totals->om_bytes_sent += op_new->om_bytes_sent;
>> +		op_totals->om_bytes_recv += op_new->om_bytes_recv;
>> +
>> +		op_totals->om_queue = ktime_add(op_totals->om_queue,
>> +					       op_new->om_queue);
>> +
>> +		op_totals->om_rtt = ktime_add(op_totals->om_rtt,
>> +					      op_new->om_rtt);
>> +
>> +		op_totals->om_execute = ktime_add(op_totals->om_execute,
>> +						 op_new->om_execute);
>> +	}
>> +}
>> +EXPORT_SYMBOL_GPL(rpc_add_iostats);
>> +
>> /*
>> * Register/unregister RPC proc files
>> */
>> -- 
>> 1.7.4.4
>> 
> 
> -- 
> Chuck Lever
> chuck[dot]lever[at]oracle[dot]com
> 
> 
> 
> 


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 1374 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] NFS: include filelayout DS rpc stats in mountstats
  2012-02-09 16:41 [PATCH] NFS: include filelayout DS rpc stats in mountstats Weston Andros Adamson
  2012-02-09 16:49 ` Chuck Lever
@ 2012-02-09 18:16 ` Myklebust, Trond
  2012-02-09 19:13   ` Adamson, Dros
  1 sibling, 1 reply; 23+ messages in thread
From: Myklebust, Trond @ 2012-02-09 18:16 UTC (permalink / raw)
  To: Adamson, Dros; +Cc: chuck.lever, linux-nfs

T24gVGh1LCAyMDEyLTAyLTA5IGF0IDExOjQxIC0wNTAwLCBXZXN0b24gQW5kcm9zIEFkYW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9uZXctPm9tX3F1ZXVlKTsNCj4gKw0KPiArCQlvcF90b3Rh
bHMtPm9tX3J0dCA9IGt0aW1lX2FkZChvcF90b3RhbHMtPm9tX3J0dCwNCj4gKwkJCQkJICAgICAg
b3BfbmV3LT5vbV9ydHQpOw0KPiArDQo+ICsJCW9wX3RvdGFscy0+b21fZXhlY3V0ZSA9IGt0aW1l
X2FkZChvcF90b3RhbHMtPm9tX2V4ZWN1dGUsDQo+ICsJCQkJCQkgb3BfbmV3LT5vbV9leGVjdXRl
KTsNCj4gKwl9DQo+ICt9DQo+ICtFWFBPUlRfU1lNQk9MX0dQTChycGNfYWRkX2lvc3RhdHMpOw0K
PiArDQo+ICAvKg0KPiAgICogUmVnaXN0ZXIvdW5yZWdpc3RlciBSUEMgcHJvYyBmaWxlcw0KPiAg
ICovDQoNCi0tIA0KVHJvbmQgTXlrbGVidXN0DQpMaW51eCBORlMgY2xpZW50IG1haW50YWluZXIN
Cg0KTmV0QXBwDQpUcm9uZC5NeWtsZWJ1c3RAbmV0YXBwLmNvbQ0Kd3d3Lm5ldGFwcC5jb20NCg0K

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] NFS: include filelayout DS rpc stats in mountstats
  2012-02-09 18:16 ` Myklebust, Trond
@ 2012-02-09 19:13   ` Adamson, Dros
  2012-02-09 19:27     ` Myklebust, Trond
  0 siblings, 1 reply; 23+ messages in thread
From: Adamson, Dros @ 2012-02-09 19:13 UTC (permalink / raw)
  To: Myklebust, Trond; +Cc: Adamson, Dros, chuck.lever, linux-nfs

[-- Attachment #1: Type: text/plain, Size: 12989 bytes --]


On Feb 9, 2012, at 1:16 PM, Myklebust, Trond wrote:

> On Thu, 2012-02-09 at 11:41 -0500, Weston Andros Adamson wrote:
>> Include RPC statistics from all data servers in /proc/self/mountstats for pNFS
>> filelayout mounts.
>> 
>> The additional info printed on the "per-op statistics" line does not break
>> current mountstats(8) from nfs-utils.
>> 
>> Signed-off-by: Weston Andros Adamson <dros@netapp.com>
>> ---
>> 
>> This is clearly a better approach than I was taking trying to keep DS rpc stats
>> separate in /proc/self/mountstats.
>> 
>> FYI, there are no other callers of rpc_print_iostats().
>> 
>> The new output of /proc/self/mountstats works fine with current mountstats 
>> userland tool.  The additional data on the per-op statistics line doesn't make
>> it into the output, but I left it in /proc/self/mountstats because it doesn't
>> break anything and can be included in newer versions of mountstats.
>> 
>> I plan on adding the per-DS stats (rpc and others) somewhere in /proc/fs/nfsfs/
>> soon.
>> 
>> fs/nfs/nfs4filelayout.c        |   30 ++++++++++++++++++++++++++
>> fs/nfs/pnfs.h                  |   23 ++++++++++++++++++++
>> fs/nfs/pnfs_dev.c              |   45 ++++++++++++++++++++++++++++++++++++++++
>> fs/nfs/super.c                 |    3 +-
>> include/linux/sunrpc/metrics.h |   13 +++++++++-
>> net/sunrpc/stats.c             |   38 ++++++++++++++++++++++++++++++++-
>> 6 files changed, 147 insertions(+), 5 deletions(-)
>> 
>> diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
>> index 79be7ac..51c71e5 100644
>> --- a/fs/nfs/nfs4filelayout.c
>> +++ b/fs/nfs/nfs4filelayout.c
>> @@ -33,6 +33,8 @@
>> #include <linux/nfs_page.h>
>> #include <linux/module.h>
>> 
>> +#include <linux/sunrpc/metrics.h>
>> +
>> #include "internal.h"
>> #include "nfs4filelayout.h"
>> 
>> @@ -918,6 +920,33 @@ filelayout_free_deveiceid_node(struct nfs4_deviceid_node *d)
>> 	nfs4_fl_free_deviceid(container_of(d, struct nfs4_file_layout_dsaddr, id_node));
>> }
>> 
>> +static unsigned int
>> +filelayout_rpc_add_iostats(struct rpc_iostats *total,
>> +			   unsigned int maxproc,
>> +			   struct nfs4_deviceid_node *d)
>> +{
>> +	struct nfs4_file_layout_dsaddr *dsaddr;
>> +	struct nfs4_pnfs_ds *ds;
>> +	unsigned int num_ds = 0;
>> +	u32 i;
>> +
>> +	dsaddr = container_of(d, struct nfs4_file_layout_dsaddr, id_node);
>> +
>> +	for (i = 0; i < dsaddr->ds_num; i++) {
>> +		ds = dsaddr->ds_list[i];
>> +
>> +		/* only add iostats if nfs_client is different from MDS */
>> +		if (ds && ds->ds_clp && d->nfs_client != ds->ds_clp) {
>> +			struct rpc_clnt *clnt = ds->ds_clp->cl_rpcclient;
> 
> Hmmm.... Shouldn't this rather be the NFS_CLIENT(inode)? Also, why not
> do this in the read/write completion code? Why walk the deviceid list at
> all?

I'm not really following you.  Note that these are rpc_iostats not nfs_iostats.  
nfs_iostats have been properly counting operations to DSs for some time now.
rpc_iostats count operations, rtt, exectime, etc per rpc procedure (or in the case of NFSv4.X there is a hack to use operations within compounds).

We have to walk the device list to get access to the underlying DS's nfs_client->rpc_client -- I can't just put this in the read/write completion because, unlike nfs_iostats, rpc_iostats count all operations and not just read/write events/bytes (not to mention that the accumulation is done at the rpc layer).

I do have an implementation that doesn't need to walk the deviceid list by allowing a shared rpc_iostats struct between multiple rpc_clients (in addition to the current rpc_iostats structure), but that required adding locking and reference counting -- all for printing stats (obviously not what we want).

Does that make sense?  If so, I'll repost with the fix from below.

Also, it just occurred to me that you might want me to separate this into two patches one for changes in net/sunrpc and one for fs/nfs...

-dros

> 
>> +			rpc_add_iostats(total, clnt->cl_metrics,
>> +					min(maxproc, clnt->cl_maxproc));
>> +			num_ds++;
>> +		}
>> +	}
>> +
>> +	return num_ds;
>> +}
>> +
>> static struct pnfs_layoutdriver_type filelayout_type = {
>> 	.id			= LAYOUT_NFSV4_1_FILES,
>> 	.name			= "LAYOUT_NFSV4_1_FILES",
>> @@ -932,6 +961,7 @@ static struct pnfs_layoutdriver_type filelayout_type = {
>> 	.read_pagelist		= filelayout_read_pagelist,
>> 	.write_pagelist		= filelayout_write_pagelist,
>> 	.free_deviceid_node	= filelayout_free_deveiceid_node,
>> +	.ds_rpc_add_iostats	= filelayout_rpc_add_iostats,
>> };
>> 
>> static int __init nfs4filelayout_init(void)
>> diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
>> index 53d593a..d1b82eb 100644
>> --- a/fs/nfs/pnfs.h
>> +++ b/fs/nfs/pnfs.h
>> @@ -72,6 +72,7 @@ enum layoutdriver_policy_flags {
>> };
>> 
>> struct nfs4_deviceid_node;
>> +struct rpc_iostats;
>> 
>> /* Per-layout driver specific registration structure */
>> struct pnfs_layoutdriver_type {
>> @@ -119,6 +120,9 @@ struct pnfs_layoutdriver_type {
>> 	void (*encode_layoutcommit) (struct pnfs_layout_hdr *layoutid,
>> 				     struct xdr_stream *xdr,
>> 				     const struct nfs4_layoutcommit_args *args);
>> +
>> +	unsigned int (*ds_rpc_add_iostats) (struct rpc_iostats *, unsigned int,
>> +					    struct nfs4_deviceid_node *);
>> };
>> 
>> struct pnfs_layout_hdr {
>> @@ -239,6 +243,10 @@ void nfs4_init_deviceid_node(struct nfs4_deviceid_node *,
>> struct nfs4_deviceid_node *nfs4_insert_deviceid_node(struct nfs4_deviceid_node *);
>> bool nfs4_put_deviceid_node(struct nfs4_deviceid_node *);
>> void nfs4_deviceid_purge_client(const struct nfs_client *);
>> +void nfs4_deviceid_rpc_print_iostats(struct seq_file *seq,
>> +				     const struct nfs_client *clp,
>> +				     const struct pnfs_layoutdriver_type *ld);
>> +
>> 
>> static inline int lo_fail_bit(u32 iomode)
>> {
>> @@ -328,6 +336,15 @@ static inline int pnfs_return_layout(struct inode *ino)
>> 	return 0;
>> }
>> 
>> +static inline int
>> +pnfs_rpc_print_iostats(struct seq_file *m, struct nfs_server *nfss)
>> +{
>> +	if (!pnfs_enabled_sb(nfss))
>> +		return 0;
>> +	nfs4_deviceid_rpc_print_iostats(m, nfss->nfs_client,
>> +					nfss->pnfs_curr_ld);
>> +	return 1;
>> +}
>> #else  /* CONFIG_NFS_V4_1 */
>> 
>> static inline void pnfs_destroy_all_layouts(struct nfs_client *clp)
>> @@ -429,6 +446,12 @@ static inline int pnfs_layoutcommit_inode(struct inode *inode, bool sync)
>> static inline void nfs4_deviceid_purge_client(struct nfs_client *ncl)
>> {
>> }
>> +
>> +static inline void
>> +pnfs_rpc_print_iostats(struct seq_file *m, struct nfs_server *nfss)
>> +{
>> +	return 0;
>> +}
>> #endif /* CONFIG_NFS_V4_1 */
>> 
>> #endif /* FS_NFS_PNFS_H */
>> diff --git a/fs/nfs/pnfs_dev.c b/fs/nfs/pnfs_dev.c
>> index 4f359d2..aa5d102 100644
>> --- a/fs/nfs/pnfs_dev.c
>> +++ b/fs/nfs/pnfs_dev.c
>> @@ -29,6 +29,9 @@
>>  */
>> 
>> #include <linux/export.h>
>> +
>> +#include <linux/sunrpc/metrics.h>
>> +
>> #include "pnfs.h"
>> 
>> #define NFSDBG_FACILITY		NFSDBG_PNFS
>> @@ -115,6 +118,48 @@ nfs4_find_get_deviceid(const struct pnfs_layoutdriver_type *ld,
>> }
>> EXPORT_SYMBOL_GPL(nfs4_find_get_deviceid);
>> 
>> +
>> +void
>> +nfs4_deviceid_rpc_print_iostats(struct seq_file *seq,
>> +				const struct nfs_client *clp,
>> +				const struct pnfs_layoutdriver_type *ld)
>> +{
>> +	struct nfs4_deviceid_node *d;
>> +	struct hlist_node *n;
>> +	struct rpc_iostats *totals;
>> +	char msgbuf[64];
>> +	unsigned int num_ds = 0;
>> +	unsigned int maxproc;
>> +	long h;
>> +
>> +	if (!ld->ds_rpc_add_iostats)
>> +		return;
>> +	totals = rpc_alloc_iostats(clp->cl_rpcclient);
>> +	if (!totals)
>> +		return;
>> +	maxproc = clp->cl_rpcclient->cl_maxproc;
>> +	rpc_add_iostats(totals, clp->cl_rpcclient->cl_metrics, maxproc);
>> +
>> +	rcu_read_lock();
>> +	for (h = 0; h < NFS4_DEVICE_ID_HASH_SIZE; h++) {
>> +		hlist_for_each_entry_rcu(d, n, &nfs4_deviceid_cache[h], node) {
>> +			if (d->ld == ld && d->nfs_client == clp) {
>> +				if (atomic_read(&d->ref))
>> +					num_ds += ld->ds_rpc_add_iostats(totals,
>> +							maxproc, d);
>> +			}
>> +		}
>> +	}
>> +	rcu_read_unlock();
>> +
>> +	snprintf(msgbuf, sizeof(msgbuf),
>> +		 " for the metadata server and %u data server%s", num_ds,
>> +		 (num_ds != 1) ? "s" : "");
>> +	rpc_print_iostats(seq, clp->cl_rpcclient, totals, msgbuf);
>> +	rpc_free_iostats(totals);
>> +}
>> +EXPORT_SYMBOL_GPL(nfs4_deviceid_rpc_print_iostats);
> 
> Is this needed? AFAICS it is used in fs/nfs/super.c, which is in the
> same module (i.e. nfs.ko).

oops!

> 
>> /*
>>  * Remove a deviceid from cache
>>  *
>> diff --git a/fs/nfs/super.c b/fs/nfs/super.c
>> index d18a90b..76d0850 100644
>> --- a/fs/nfs/super.c
>> +++ b/fs/nfs/super.c
>> @@ -870,7 +870,8 @@ static int nfs_show_stats(struct seq_file *m, struct dentry *root)
>> #endif
>> 	seq_printf(m, "\n");
>> 
>> -	rpc_print_iostats(m, nfss->client);
>> +	if (!pnfs_rpc_print_iostats(m, nfss))
>> +		rpc_print_iostats(m, nfss->client, NULL, NULL);
>> 
>> 	return 0;
>> }
>> diff --git a/include/linux/sunrpc/metrics.h b/include/linux/sunrpc/metrics.h
>> index b6edbc0..e6e04e4 100644
>> --- a/include/linux/sunrpc/metrics.h
>> +++ b/include/linux/sunrpc/metrics.h
>> @@ -75,14 +75,23 @@ struct rpc_clnt;
>> 
>> struct rpc_iostats *	rpc_alloc_iostats(struct rpc_clnt *);
>> void			rpc_count_iostats(struct rpc_task *);
>> -void			rpc_print_iostats(struct seq_file *, struct rpc_clnt *);
>> +void			rpc_print_iostats(struct seq_file *,
>> +					  struct rpc_clnt *,
>> +					  struct rpc_iostats *,
>> +					  const char *);
>> +void			rpc_add_iostats(struct rpc_iostats *,
>> +					struct rpc_iostats *, unsigned int);
>> void			rpc_free_iostats(struct rpc_iostats *);
>> 
>> #else  /*  CONFIG_PROC_FS  */
>> 
>> static inline struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt) { return NULL; }
>> static inline void rpc_count_iostats(struct rpc_task *task) {}
>> -static inline void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt) {}
>> +static inline void rpc_print_iostats(struct seq_file *seq,
>> +				     struct rpc_iostats *stat) {}
>> +static inline void rpc_add_iostats(struct rpc_iostats *total,
>> +				   struct rpc_iostats *new,
>> +				   unsigned int maxproc) {}
>> static inline void rpc_free_iostats(struct rpc_iostats *stats) {}
>> 
>> #endif  /*  CONFIG_PROC_FS  */
>> diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c
>> index 3c4f688..342df57 100644
>> --- a/net/sunrpc/stats.c
>> +++ b/net/sunrpc/stats.c
>> @@ -176,12 +176,16 @@ static void _print_name(struct seq_file *seq, unsigned int op,
>> 		seq_printf(seq, "\t%12u: ", op);
>> }
>> 
>> -void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt)
>> +void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt,
>> +		       struct rpc_iostats *altstats,
>> +		       const char *altstats_msg)
>> {
>> 	struct rpc_iostats *stats = clnt->cl_metrics;
>> 	struct rpc_xprt *xprt = clnt->cl_xprt;
>> 	unsigned int op, maxproc = clnt->cl_maxproc;
>> 
>> +	if (altstats)
>> +		stats = altstats;
>> 	if (!stats)
>> 		return;
>> 
>> @@ -192,7 +196,8 @@ void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt)
>> 	if (xprt)
>> 		xprt->ops->print_stats(xprt, seq);
>> 
>> -	seq_printf(seq, "\tper-op statistics\n");
>> +	seq_printf(seq, "\tper-op statistics%s\n",
>> +		   (altstats && altstats_msg) ? altstats_msg : "");
>> 	for (op = 0; op < maxproc; op++) {
>> 		struct rpc_iostats *metrics = &stats[op];
>> 		_print_name(seq, op, clnt->cl_procinfo);
>> @@ -209,6 +214,35 @@ void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt)
>> }
>> EXPORT_SYMBOL_GPL(rpc_print_iostats);
>> 
>> +void
>> +rpc_add_iostats(struct rpc_iostats *totals, struct rpc_iostats *new,
>> +		unsigned int maxproc)
>> +{
>> +	unsigned int op;
>> +
>> +	for (op = 0; op < maxproc; op++) {
>> +		struct rpc_iostats *op_totals = &totals[op],
>> +				   *op_new = &new[op];
>> +
>> +		op_totals->om_ops += op_new->om_ops;
>> +		op_totals->om_ntrans += op_new->om_ntrans;
>> +		op_totals->om_timeouts += op_new->om_timeouts;
>> +
>> +		op_totals->om_bytes_sent += op_new->om_bytes_sent;
>> +		op_totals->om_bytes_recv += op_new->om_bytes_recv;
>> +
>> +		op_totals->om_queue = ktime_add(op_totals->om_queue,
>> +					       op_new->om_queue);
>> +
>> +		op_totals->om_rtt = ktime_add(op_totals->om_rtt,
>> +					      op_new->om_rtt);
>> +
>> +		op_totals->om_execute = ktime_add(op_totals->om_execute,
>> +						 op_new->om_execute);
>> +	}
>> +}
>> +EXPORT_SYMBOL_GPL(rpc_add_iostats);
>> +
>> /*
>>  * Register/unregister RPC proc files
>>  */
> 
> -- 
> Trond Myklebust
> Linux NFS client maintainer
> 
> NetApp
> Trond.Myklebust@netapp.com
> www.netapp.com
> 


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 1374 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] NFS: include filelayout DS rpc stats in mountstats
  2012-02-09 19:13   ` Adamson, Dros
@ 2012-02-09 19:27     ` Myklebust, Trond
  2012-02-09 19:48       ` Adamson, Dros
  0 siblings, 1 reply; 23+ messages in thread
From: Myklebust, Trond @ 2012-02-09 19:27 UTC (permalink / raw)
  To: Adamson, Dros; +Cc: chuck.lever, linux-nfs

T24gVGh1LCAyMDEyLTAyLTA5IGF0IDE5OjEzICswMDAwLCBBZGFtc29uLCBEcm9zIHdyb3RlOg0K
PiBPbiBGZWIgOSwgMjAxMiwgYXQgMToxNiBQTSwgTXlrbGVidXN0LCBUcm9uZCB3cm90ZToNCj4g
DQo+ID4gT24gVGh1LCAyMDEyLTAyLTA5IGF0IDExOjQxIC0wNTAwLCBXZXN0b24gQW5kcm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Mgc3RydWN0dXJlKSwgYnV0IHRoYXQgcmVxdWlyZWQgYWRkaW5nIGxvY2tpbmcgYW5kIHJl
ZmVyZW5jZSBjb3VudGluZyAtLSBhbGwgZm9yIHByaW50aW5nIHN0YXRzIChvYnZpb3VzbHkgbm90
IHdoYXQgd2Ugd2FudCkuDQoNClRoaXMgbWlnaHQgYmUgbW9yZSBpbiBsaW5lIHdpdGggd2hhdCB3
ZSB3YW50LiBOb3RlIHRoYXQgaXQgc2hvdWxkIGJlDQplYXN5IHRvIGNsb25lIGFuIHJwY19jbGll
bnQgYW5kIHRoZW4gcmVwbGFjZSBpdHMgcnBjX2lvc3RhdHMgc3RydWN0LiBJDQpkb24ndCB0aGlu
ayB0aGF0IG5lZWRzIGFueSBleHRyYSBsb2NraW5nLiBXZSdyZSBhbHJlYWR5IGlnbm9yaW5nIGxv
Y2tpbmcNCmhlcmUgYmV0d2VlbiBkaWZmZXJlbnQgcnBjX3Rhc2tzLCBzbyB0aHJvd2luZyBpbiBk
aWZmZXJlbnQgcnBjX2NsaWVudHMNCnRvIHRoZSBtaXggd2lsbCBtYWtlIG5vIGRpZmZlcmVuY2Uu
DQoNCg0KLS0gDQpUcm9uZCBNeWtsZWJ1c3QNCkxpbnV4IE5GUyBjbGllbnQgbWFpbnRhaW5lcg0K
DQpOZXRBcHANClRyb25kLk15a2xlYnVzdEBuZXRhcHAuY29tDQp3d3cubmV0YXBwLmNvbQ0KDQo=

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] NFS: include filelayout DS rpc stats in mountstats
  2012-02-09 19:27     ` Myklebust, Trond
@ 2012-02-09 19:48       ` Adamson, Dros
  2012-02-09 19:58         ` Myklebust, Trond
  2012-02-09 20:00         ` Myklebust, Trond
  0 siblings, 2 replies; 23+ messages in thread
From: Adamson, Dros @ 2012-02-09 19:48 UTC (permalink / raw)
  To: Myklebust, Trond; +Cc: Adamson, Dros, Chuck Lever, linux-nfs list

[-- Attachment #1: Type: text/plain, Size: 5590 bytes --]


On Feb 9, 2012, at 2:27 PM, Myklebust, Trond wrote:

> On Thu, 2012-02-09 at 19:13 +0000, Adamson, Dros wrote:
>> On Feb 9, 2012, at 1:16 PM, Myklebust, Trond wrote:
>> 
>>> On Thu, 2012-02-09 at 11:41 -0500, Weston Andros Adamson wrote:
>>>> Include RPC statistics from all data servers in /proc/self/mountstats for pNFS
>>>> filelayout mounts.
>>>> 
>>>> The additional info printed on the "per-op statistics" line does not break
>>>> current mountstats(8) from nfs-utils.
>>>> 
>>>> Signed-off-by: Weston Andros Adamson <dros@netapp.com>
>>>> ---
>>>> 
>>>> This is clearly a better approach than I was taking trying to keep DS rpc stats
>>>> separate in /proc/self/mountstats.
>>>> 
>>>> FYI, there are no other callers of rpc_print_iostats().
>>>> 
>>>> The new output of /proc/self/mountstats works fine with current mountstats 
>>>> userland tool.  The additional data on the per-op statistics line doesn't make
>>>> it into the output, but I left it in /proc/self/mountstats because it doesn't
>>>> break anything and can be included in newer versions of mountstats.
>>>> 
>>>> I plan on adding the per-DS stats (rpc and others) somewhere in /proc/fs/nfsfs/
>>>> soon.
>>>> 
>>>> fs/nfs/nfs4filelayout.c        |   30 ++++++++++++++++++++++++++
>>>> fs/nfs/pnfs.h                  |   23 ++++++++++++++++++++
>>>> fs/nfs/pnfs_dev.c              |   45 ++++++++++++++++++++++++++++++++++++++++
>>>> fs/nfs/super.c                 |    3 +-
>>>> include/linux/sunrpc/metrics.h |   13 +++++++++-
>>>> net/sunrpc/stats.c             |   38 ++++++++++++++++++++++++++++++++-
>>>> 6 files changed, 147 insertions(+), 5 deletions(-)
>>>> 
>>>> diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
>>>> index 79be7ac..51c71e5 100644
>>>> --- a/fs/nfs/nfs4filelayout.c
>>>> +++ b/fs/nfs/nfs4filelayout.c
>>>> @@ -33,6 +33,8 @@
>>>> #include <linux/nfs_page.h>
>>>> #include <linux/module.h>
>>>> 
>>>> +#include <linux/sunrpc/metrics.h>
>>>> +
>>>> #include "internal.h"
>>>> #include "nfs4filelayout.h"
>>>> 
>>>> @@ -918,6 +920,33 @@ filelayout_free_deveiceid_node(struct nfs4_deviceid_node *d)
>>>> 	nfs4_fl_free_deviceid(container_of(d, struct nfs4_file_layout_dsaddr, id_node));
>>>> }
>>>> 
>>>> +static unsigned int
>>>> +filelayout_rpc_add_iostats(struct rpc_iostats *total,
>>>> +			   unsigned int maxproc,
>>>> +			   struct nfs4_deviceid_node *d)
>>>> +{
>>>> +	struct nfs4_file_layout_dsaddr *dsaddr;
>>>> +	struct nfs4_pnfs_ds *ds;
>>>> +	unsigned int num_ds = 0;
>>>> +	u32 i;
>>>> +
>>>> +	dsaddr = container_of(d, struct nfs4_file_layout_dsaddr, id_node);
>>>> +
>>>> +	for (i = 0; i < dsaddr->ds_num; i++) {
>>>> +		ds = dsaddr->ds_list[i];
>>>> +
>>>> +		/* only add iostats if nfs_client is different from MDS */
>>>> +		if (ds && ds->ds_clp && d->nfs_client != ds->ds_clp) {
>>>> +			struct rpc_clnt *clnt = ds->ds_clp->cl_rpcclient;
>>> 
>>> Hmmm.... Shouldn't this rather be the NFS_CLIENT(inode)? Also, why not
>>> do this in the read/write completion code? Why walk the deviceid list at
>>> all?
>> 
>> I'm not really following you.  Note that these are rpc_iostats not nfs_iostats.  
>> nfs_iostats have been properly counting operations to DSs for some time now.
>> rpc_iostats count operations, rtt, exectime, etc per rpc procedure (or in the case of NFSv4.X there is a hack to use operations within compounds).
>> 
>> We have to walk the device list to get access to the underlying DS's nfs_client->rpc_client -- I can't just put this in the read/write completion because, unlike nfs_iostats, rpc_iostats count all operations and not just read/write events/bytes (not to mention that the accumulation is done at the rpc layer).
> 
> In doing this, you are assuming that DSes are not shared among multiple
> filesystems or MDSes (i.e. that each DS is used by a single struct
> nfs_server). For something like a NetApp filer in c-mode, that is
> clearly not a valid assumption.

True - I had thought of this, but I thought it was fine since I was just carrying this assumption forward...

The current mountstats code already prints nfs_server->nfs_client->rpc_client->rpc_iostats -- which clearly doesn't differentiate between multiple nfs_servers that could be sharing the nfs_client.

> 
>> I do have an implementation that doesn't need to walk the deviceid list by allowing a shared rpc_iostats struct between multiple rpc_clients (in addition to the current rpc_iostats structure), but that required adding locking and reference counting -- all for printing stats (obviously not what we want).
> 
> This might be more in line with what we want. Note that it should be
> easy to clone an rpc_client and then replace its rpc_iostats struct. I
> don't think that needs any extra locking. We're already ignoring locking
> here between different rpc_tasks, so throwing in different rpc_clients
> to the mix will make no difference.

Yeah, that's easy enough and i guess we could ignore locking, but we are still left with the same problem: how is this supposed to account for different mount points using the same nfs_client?  nfs_client only has one rpc_client member.  I doubt we want to make a hash lookup on nfs_server to get the right rpc_client (which could all use the same underlying xprt).

Maybe it's time to move these stats into fs/nfs/ where they really belong?  We could get rid of the hack that overloads procnum with opnum from inside the compound for v4+ and finally only show a specific mount's RPC stats.

Thoughts?

-dros



[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 1374 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] NFS: include filelayout DS rpc stats in mountstats
  2012-02-09 19:48       ` Adamson, Dros
@ 2012-02-09 19:58         ` Myklebust, Trond
  2012-02-09 20:23           ` Adamson, Dros
  2012-02-09 20:00         ` Myklebust, Trond
  1 sibling, 1 reply; 23+ messages in thread
From: Myklebust, Trond @ 2012-02-09 19:58 UTC (permalink / raw)
  To: Adamson, Dros; +Cc: Chuck Lever, linux-nfs list

T24gVGh1LCAyMDEyLTAyLTA5IGF0IDE5OjQ4ICswMDAwLCBBZGFtc29uLCBEcm9zIHdyb3RlOg0K
PiA+IA0KPiA+PiBJIGRvIGhhdmUgYW4gaW1wbGVtZW50YXRpb24gdGhhdCBkb2Vzbid0IG5lZWQg
dG8gd2FsayB0aGUgZGV2aWNlaWQgbGlzdCBieSBhbGxvd2luZyBhIHNoYXJlZCBycGNfaW9zdGF0
cyBzdHJ1Y3QgYmV0d2VlbiBtdWx0aXBsZSBycGN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[PATCH] NFS: include filelayout DS rpc stats in mountstats
  2012-02-09 19:48       ` Adamson, Dros
  2012-02-09 19:58         ` Myklebust, Trond
@ 2012-02-09 20:00         ` Myklebust, Trond
  1 sibling, 0 replies; 23+ messages in thread
From: Myklebust, Trond @ 2012-02-09 20:00 UTC (permalink / raw)
  To: Adamson, Dros; +Cc: Chuck Lever, linux-nfs list

T24gVGh1LCAyMDEyLTAyLTA5IGF0IDE5OjQ4ICswMDAwLCBBZGFtc29uLCBEcm9zIHdyb3RlOg0K
PiA+IA0KPiA+PiBJIGRvIGhhdmUgYW4gaW1wbGVtZW50YXRpb24gdGhhdCBkb2Vzbid0IG5lZWQg
dG8gd2FsayB0aGUgZGV2aWNlaWQgbGlzdCBieSBhbGxvd2luZyBhIHNoYXJlZCBycGNfaW9zdGF0
cyBzdHJ1Y3QgYmV0d2VlbiBtdWx0aXBsZSBycGNfY2xpZW50cyAoaW4gYWRkaXRpb24gdG8gdGhl
IGN1cnJlbnQgcnBjX2lvc3RhdHMgc3RydWN0dXJlKSwgYnV0IHRoYXQgcmVxdWlyZWQgYWRkaW5n
IGxvY2tpbmcgYW5kIHJlZmVyZW5jZSBjb3VudGluZyAtLSBhbGwgZm9yIHByaW50aW5nIHN0YXRz
IChvYnZpb3VzbHkgbm90IHdoYXQgd2Ugd2FudCkuDQo+ID4gDQo+ID4gVGhpcyBtaWdodCBiZSBt
b3JlIGluIGxpbmUgd2l0aCB3aGF0IHdlIHdhbnQuIE5vdGUgdGhhdCBpdCBzaG91bGQgYmUNCj4g
PiBlYXN5IHRvIGNsb25lIGFuIHJwY19jbGllbnQgYW5kIHRoZW4gcmVwbGFjZSBpdHMgcnBjX2lv
c3RhdHMgc3RydWN0LiBJDQo+ID4gZG9uJ3QgdGhpbmsgdGhhdCBuZWVkcyBhbnkgZXh0cmEgbG9j
a2luZy4gV2UncmUgYWxyZWFkeSBpZ25vcmluZyBsb2NraW5nDQo+ID4gaGVyZSBiZXR3ZWVuIGRp
ZmZlcmV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CB3
b3VsZCBiZSBjYWxsZWQgaW5zdGVhZCBvZiBycGNfY291bnRfaW9zdGF0cygpLiANCklmIHlvdSB0
aGVuIG1vZGlmeSBycGNfY291bnRfaW9zdGF0cygpIHRvIHRha2UgdGhlICdzdGF0cycgdmFyaWFi
bGUgYXMgYQ0KcGFyYW1ldGVyLCB5b3UgY2FuIHNpbXBseSBoYXZlIHRoZSBuZXcgY2FsbGJhY2sg
Y2FsbCBycGNfY291bnRfaW9zdGF0cw0Kd2l0aCB0aGUgcmlnaHQgYXJndW1lbnRzLg0KDQotLSAN
ClRyb25kIE15a2xlYnVzdA0KTGludXggTkZTIGNsaWVudCBtYWludGFpbmVyDQoNCk5ldEFwcA0K
VHJvbmQuTXlrbGVidXN0QG5ldGFwcC5jb20NCnd3dy5uZXRhcHAuY29tDQoNCg0K

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] NFS: include filelayout DS rpc stats in mountstats
  2012-02-09 19:58         ` Myklebust, Trond
@ 2012-02-09 20:23           ` Adamson, Dros
  2012-02-09 20:37             ` Myklebust, Trond
  0 siblings, 1 reply; 23+ messages in thread
From: Adamson, Dros @ 2012-02-09 20:23 UTC (permalink / raw)
  To: Myklebust, Trond; +Cc: Adamson, Dros, Chuck Lever, linux-nfs list

[-- Attachment #1: Type: text/plain, Size: 2594 bytes --]


On Feb 9, 2012, at 2:58 PM, Myklebust, Trond wrote:

> On Thu, 2012-02-09 at 19:48 +0000, Adamson, Dros wrote:
>>> 
>>>> I do have an implementation that doesn't need to walk the deviceid list by allowing a shared rpc_iostats struct between multiple rpc_clients (in addition to the current rpc_iostats structure), but that required adding locking and reference counting -- all for printing stats (obviously not what we want).
>>> 
>>> This might be more in line with what we want. Note that it should be
>>> easy to clone an rpc_client and then replace its rpc_iostats struct. I
>>> don't think that needs any extra locking. We're already ignoring locking
>>> here between different rpc_tasks, so throwing in different rpc_clients
>>> to the mix will make no difference.
>> 
>> Yeah, that's easy enough and i guess we could ignore locking, but we are still left with the same problem: how is this supposed to account for different mount points using the same nfs_client?  nfs_client only has one rpc_client member.  I doubt we want to make a hash lookup on nfs_server to get the right rpc_client (which could all use the same underlying xprt).
>> 
>> Maybe it's time to move these stats into fs/nfs/ where they really belong?  We could get rid of the hack that overloads procnum with opnum from inside the compound for v4+ and finally only show a specific mount's RPC stats.
> 
> Actually, how about just adding a callback into struct rpc_call_ops
> that, if it is defined, would be called instead of rpc_count_iostats(). 
> If you then modify rpc_count_iostats() to take the 'stats' variable as a
> parameter, you can simply have the new callback call rpc_count_iostats
> with the right arguments.

Yeah, that could work!  On my walk home from the cafe (they always seem to help) I came up with a slightly different strategy:

- remove the cl_metrics (struct rpc_iostats) member from rpc_clnt
- add an *optional* rpc_iostats pointer to rpc_task (ignored if NULL)
- allocate one rpc_iostats structure (really array of structs, but you know what I mean) per nfs_server structure
- when setting up rpc_tasks in nfs-land, pass the correct rpc_iostats

with this strategy we don't accumulate stats when they aren't ever used (like an rpc_client used for mount protocol).  again, only NFS uses the rpc stats interface.

I kind of like this better than a callback, but either way is fine with me.  Which way would you prefer?

-dros

> 
> -- 
> Trond Myklebust
> Linux NFS client maintainer
> 
> NetApp
> Trond.Myklebust@netapp.com
> www.netapp.com
> 


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 1374 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] NFS: include filelayout DS rpc stats in mountstats
  2012-02-09 20:23           ` Adamson, Dros
@ 2012-02-09 20:37             ` Myklebust, Trond
  2012-02-09 20:47               ` Adamson, Dros
  0 siblings, 1 reply; 23+ messages in thread
From: Myklebust, Trond @ 2012-02-09 20:37 UTC (permalink / raw)
  To: Adamson, Dros; +Cc: Chuck Lever, linux-nfs list

T24gVGh1LCAyMDEyLTAyLTA5IGF0IDIwOjIzICswMDAwLCBBZGFtc29uLCBEcm9zIHdyb3RlOg0K
PiBPbiBGZWIgOSwgMjAxMiwgYXQgMjo1OCBQTSwgTXlrbGVidX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RzIGlu
dGVyZmFjZS4NCj4gDQo+IEkga2luZCBvZiBsaWtlIHRoaXMgYmV0dGVyIHRoYW4gYSBjYWxsYmFj
aywgYnV0IGVpdGhlciB3YXkgaXMgZmluZSB3aXRoIG1lLiAgV2hpY2ggd2F5IHdvdWxkIHlvdSBw
cmVmZXI/DQoNCkknZCBwcmVmZXIgbm90IHRvIGhhdmUgdG8gZ3JvdyB0aGUgc2l6ZSBvZiB0aGUg
cnBjX3Rhc2sgdW5sZXNzIHdlIHJlYWxseQ0KbmVlZCB0by4gVGhhdCdzIHdoeSBJIHN1Z2dlc3Rl
ZCB0aGUgY2FsbGJhY2sgaW5zdGVhZC4NCg0KQ2hlZXJzDQogIFRyb25kDQoNCi0tIA0KVHJvbmQg
TXlrbGVidXN0DQpMaW51eCBORlMgY2xpZW50IG1haW50YWluZXINCg0KTmV0QXBwDQpUcm9uZC5N
eWtsZWJ1c3RAbmV0YXBwLmNvbQ0Kd3d3Lm5ldGFwcC5jb20NCg0K

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] NFS: include filelayout DS rpc stats in mountstats
  2012-02-09 20:37             ` Myklebust, Trond
@ 2012-02-09 20:47               ` Adamson, Dros
  0 siblings, 0 replies; 23+ messages in thread
From: Adamson, Dros @ 2012-02-09 20:47 UTC (permalink / raw)
  To: Myklebust, Trond; +Cc: Adamson, Dros, Chuck Lever, linux-nfs list

[-- Attachment #1: Type: text/plain, Size: 3037 bytes --]

On Feb 9, 2012, at 3:37 PM, Myklebust, Trond wrote:

> On Thu, 2012-02-09 at 20:23 +0000, Adamson, Dros wrote:
>> On Feb 9, 2012, at 2:58 PM, Myklebust, Trond wrote:
>> 
>>> On Thu, 2012-02-09 at 19:48 +0000, Adamson, Dros wrote:
>>>>> 
>>>>>> I do have an implementation that doesn't need to walk the deviceid list by allowing a shared rpc_iostats struct between multiple rpc_clients (in addition to the current rpc_iostats structure), but that required adding locking and reference counting -- all for printing stats (obviously not what we want).
>>>>> 
>>>>> This might be more in line with what we want. Note that it should be
>>>>> easy to clone an rpc_client and then replace its rpc_iostats struct. I
>>>>> don't think that needs any extra locking. We're already ignoring locking
>>>>> here between different rpc_tasks, so throwing in different rpc_clients
>>>>> to the mix will make no difference.
>>>> 
>>>> Yeah, that's easy enough and i guess we could ignore locking, but we are still left with the same problem: how is this supposed to account for different mount points using the same nfs_client?  nfs_client only has one rpc_client member.  I doubt we want to make a hash lookup on nfs_server to get the right rpc_client (which could all use the same underlying xprt).
>>>> 
>>>> Maybe it's time to move these stats into fs/nfs/ where they really belong?  We could get rid of the hack that overloads procnum with opnum from inside the compound for v4+ and finally only show a specific mount's RPC stats.
>>> 
>>> Actually, how about just adding a callback into struct rpc_call_ops
>>> that, if it is defined, would be called instead of rpc_count_iostats(). 
>>> If you then modify rpc_count_iostats() to take the 'stats' variable as a
>>> parameter, you can simply have the new callback call rpc_count_iostats
>>> with the right arguments.
>> 
>> Yeah, that could work!  On my walk home from the cafe (they always seem to help) I came up with a slightly different strategy:
>> 
>> - remove the cl_metrics (struct rpc_iostats) member from rpc_clnt
>> - add an *optional* rpc_iostats pointer to rpc_task (ignored if NULL)
>> - allocate one rpc_iostats structure (really array of structs, but you know what I mean) per nfs_server structure
>> - when setting up rpc_tasks in nfs-land, pass the correct rpc_iostats
>> 
>> with this strategy we don't accumulate stats when they aren't ever used (like an rpc_client used for mount protocol).  again, only NFS uses the rpc stats interface.
>> 
>> I kind of like this better than a callback, but either way is fine with me.  Which way would you prefer?
> 
> I'd prefer not to have to grow the size of the rpc_task unless we really
> need to. That's why I suggested the callback instead.

Good to know!  I'll do the callback method.

Also, I'm going to go ahead with removing the cl_metrics member from rpc_clnt -- once we have the callback it'll never be used.

Thanks for pointing me in the right direction.  Expect a patch soon!

-dros

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 1374 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] NFS: include filelayout DS rpc stats in mountstats
  2012-02-17 19:04     ` Myklebust, Trond
@ 2012-02-17 19:16       ` Adamson, Dros
  0 siblings, 0 replies; 23+ messages in thread
From: Adamson, Dros @ 2012-02-17 19:16 UTC (permalink / raw)
  To: Myklebust, Trond; +Cc: Adamson, Dros, linux-nfs

[-- Attachment #1: Type: text/plain, Size: 1023 bytes --]


On Feb 17, 2012, at 2:04 PM, Myklebust, Trond wrote:

>> -----Original Message-----
>> From: Adamson, Dros
>> Sent: Friday, February 17, 2012 2:02 PM
>> To: Myklebust, Trond
>> Cc: Adamson, Dros; linux-nfs@vger.kernel.org
>> Subject: Re: [PATCH] NFS: include filelayout DS rpc stats in mountstats
>> 
>> On Feb 17, 2012, at 1:47 PM, Myklebust, Trond wrote:
>> 
>>> On Fri, 2012-02-17 at 13:15 -0500, Weston Andros Adamson wrote:
>>>> Include RPC statistics from all data servers in /proc/self/mountstats for
>> pNFS
>>>> filelayout mounts.
>>>> 
>>>> Signed-off-by: Weston Andros Adamson <dros@netapp.com>
>>>> ---
>>>> Update: don't increment tk_client stats if callback is used.
>>>> 
>>>> This still checks task->tk_client != NULL -- I'm not convinced it's unneeded
>>>> as it existed in rpc_count_iostats.
>>> 
>>> I'll remove it before applying.
>> 
>> I can repost the patch, if that's easier.
> 
> Nah. I've already applied and pushed to the git repository.
> 

Cool, thanks!

-dros

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 1374 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* RE: [PATCH] NFS: include filelayout DS rpc stats in mountstats
  2012-02-17 19:02   ` Adamson, Dros
@ 2012-02-17 19:04     ` Myklebust, Trond
  2012-02-17 19:16       ` Adamson, Dros
  0 siblings, 1 reply; 23+ messages in thread
From: Myklebust, Trond @ 2012-02-17 19:04 UTC (permalink / raw)
  To: Adamson, Dros; +Cc: linux-nfs

PiAtLS0tLU9yaWdpbmFsIE1lc3NhZ2UtLS0tLQ0KPiBGcm9tOiBBZGFtc29uLCBEcm9zDQo+IFNl
bnQ6IEZya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ZWFzaWVyLg0K
DQpOYWguIEkndmUgYWxyZWFkeSBhcHBsaWVkIGFuZCBwdXNoZWQgdG8gdGhlIGdpdCByZXBvc2l0
b3J5Lg0KDQo=

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] NFS: include filelayout DS rpc stats in mountstats
  2012-02-17 18:47 ` Myklebust, Trond
@ 2012-02-17 19:02   ` Adamson, Dros
  2012-02-17 19:04     ` Myklebust, Trond
  0 siblings, 1 reply; 23+ messages in thread
From: Adamson, Dros @ 2012-02-17 19:02 UTC (permalink / raw)
  To: Myklebust, Trond; +Cc: Adamson, Dros, linux-nfs

[-- Attachment #1: Type: text/plain, Size: 583 bytes --]

On Feb 17, 2012, at 1:47 PM, Myklebust, Trond wrote:

> On Fri, 2012-02-17 at 13:15 -0500, Weston Andros Adamson wrote:
>> Include RPC statistics from all data servers in /proc/self/mountstats for pNFS
>> filelayout mounts.
>> 
>> Signed-off-by: Weston Andros Adamson <dros@netapp.com>
>> ---
>> Update: don't increment tk_client stats if callback is used.
>> 
>> This still checks task->tk_client != NULL -- I'm not convinced it's unneeded
>> as it existed in rpc_count_iostats.
> 
> I'll remove it before applying.

I can repost the patch, if that's easier.

-dros

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 1374 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] NFS: include filelayout DS rpc stats in mountstats
  2012-02-17 18:15 Weston Andros Adamson
@ 2012-02-17 18:47 ` Myklebust, Trond
  2012-02-17 19:02   ` Adamson, Dros
  0 siblings, 1 reply; 23+ messages in thread
From: Myklebust, Trond @ 2012-02-17 18:47 UTC (permalink / raw)
  To: Adamson, Dros; +Cc: linux-nfs

T24gRnJpLCAyMDEyLTAyLTE3IGF0IDEzOjE1IC0wNTAwLCBXZXN0b24gQW5kcm9zIEFkYW1zb24g
d3JvdGU6DQo+IEluY2x1ZGUgUlBDIHN0YXRpc3RpY3MgZnJvbSBhbGwgZGF0YSBz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+dGtfb3BzLT5ycGNfY291bnRfc3RhdHModGFzaywgdGFzay0+dGtfY2FsbGRhdGEpOw0K
PiArCWVsc2UgaWYgKHRhc2stPnRrX2NsaWVudCkNCj4gKwkJcnBjX2NvdW50X2lvc3RhdHModGFz
aywgdGFzay0+dGtfY2xpZW50LT5jbF9tZXRyaWNzKTsNCj4gIAlzcGluX2xvY2tfYmgoJnhwcnQt
PnRyYW5zcG9ydF9sb2NrKTsNCj4gIAl4cHJ0LT5vcHMtPnJlbGVhc2VfeHBydCh4cHJ0LCB0YXNr
KTsNCj4gIAlpZiAoeHBydC0+b3BzLT5yZWxlYXNlX3JlcXVlc3QpDQoNCi0tIA0KVHJvbmQgTXlr
bGVidXN0DQpMaW51eCBORlMgY2xpZW50IG1haW50YWluZXINCg0KTmV0QXBwDQpUcm9uZC5NeWts
ZWJ1c3RAbmV0YXBwLmNvbQ0Kd3d3Lm5ldGFwcC5jb20NCg0K

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH] NFS: include filelayout DS rpc stats in mountstats
@ 2012-02-17 18:15 Weston Andros Adamson
  2012-02-17 18:47 ` Myklebust, Trond
  0 siblings, 1 reply; 23+ messages in thread
From: Weston Andros Adamson @ 2012-02-17 18:15 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, Weston Andros Adamson

Include RPC statistics from all data servers in /proc/self/mountstats for pNFS
filelayout mounts.

Signed-off-by: Weston Andros Adamson <dros@netapp.com>
---
Update: don't increment tk_client stats if callback is used.

This still checks task->tk_client != NULL -- I'm not convinced it's unneeded
as it existed in rpc_count_iostats.

 fs/nfs/nfs4filelayout.c        |   19 +++++++++++++++++++
 include/linux/sunrpc/metrics.h |    6 ++++--
 include/linux/sunrpc/sched.h   |    1 +
 net/sunrpc/stats.c             |    8 ++++----
 net/sunrpc/xprt.c              |    5 ++++-
 5 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index 79be7ac..47e8f34 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -33,6 +33,8 @@
 #include <linux/nfs_page.h>
 #include <linux/module.h>
 
+#include <linux/sunrpc/metrics.h>
+
 #include "internal.h"
 #include "nfs4filelayout.h"
 
@@ -189,6 +191,13 @@ static void filelayout_read_call_done(struct rpc_task *task, void *data)
 	rdata->mds_ops->rpc_call_done(task, data);
 }
 
+static void filelayout_read_count_stats(struct rpc_task *task, void *data)
+{
+	struct nfs_read_data *rdata = (struct nfs_read_data *)data;
+
+	rpc_count_iostats(task, NFS_SERVER(rdata->inode)->client->cl_metrics);
+}
+
 static void filelayout_read_release(void *data)
 {
 	struct nfs_read_data *rdata = (struct nfs_read_data *)data;
@@ -268,6 +277,13 @@ static void filelayout_write_call_done(struct rpc_task *task, void *data)
 	wdata->mds_ops->rpc_call_done(task, data);
 }
 
+static void filelayout_write_count_stats(struct rpc_task *task, void *data)
+{
+	struct nfs_write_data *wdata = (struct nfs_write_data *)data;
+
+	rpc_count_iostats(task, NFS_SERVER(wdata->inode)->client->cl_metrics);
+}
+
 static void filelayout_write_release(void *data)
 {
 	struct nfs_write_data *wdata = (struct nfs_write_data *)data;
@@ -288,18 +304,21 @@ static void filelayout_commit_release(void *data)
 struct rpc_call_ops filelayout_read_call_ops = {
 	.rpc_call_prepare = filelayout_read_prepare,
 	.rpc_call_done = filelayout_read_call_done,
+	.rpc_count_stats = filelayout_read_count_stats,
 	.rpc_release = filelayout_read_release,
 };
 
 struct rpc_call_ops filelayout_write_call_ops = {
 	.rpc_call_prepare = filelayout_write_prepare,
 	.rpc_call_done = filelayout_write_call_done,
+	.rpc_count_stats = filelayout_write_count_stats,
 	.rpc_release = filelayout_write_release,
 };
 
 struct rpc_call_ops filelayout_commit_call_ops = {
 	.rpc_call_prepare = filelayout_write_prepare,
 	.rpc_call_done = filelayout_write_call_done,
+	.rpc_count_stats = filelayout_write_count_stats,
 	.rpc_release = filelayout_commit_release,
 };
 
diff --git a/include/linux/sunrpc/metrics.h b/include/linux/sunrpc/metrics.h
index b6edbc0..1565bbe 100644
--- a/include/linux/sunrpc/metrics.h
+++ b/include/linux/sunrpc/metrics.h
@@ -74,14 +74,16 @@ struct rpc_clnt;
 #ifdef CONFIG_PROC_FS
 
 struct rpc_iostats *	rpc_alloc_iostats(struct rpc_clnt *);
-void			rpc_count_iostats(struct rpc_task *);
+void			rpc_count_iostats(const struct rpc_task *,
+					  struct rpc_iostats *);
 void			rpc_print_iostats(struct seq_file *, struct rpc_clnt *);
 void			rpc_free_iostats(struct rpc_iostats *);
 
 #else  /*  CONFIG_PROC_FS  */
 
 static inline struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt) { return NULL; }
-static inline void rpc_count_iostats(struct rpc_task *task) {}
+static inline void rpc_count_iostats(const struct rpc_task *task,
+				     struct rpc_iostats *stats) {}
 static inline void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt) {}
 static inline void rpc_free_iostats(struct rpc_iostats *stats) {}
 
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 22dfc24..dc0c3cc 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -103,6 +103,7 @@ typedef void			(*rpc_action)(struct rpc_task *);
 struct rpc_call_ops {
 	void (*rpc_call_prepare)(struct rpc_task *, void *);
 	void (*rpc_call_done)(struct rpc_task *, void *);
+	void (*rpc_count_stats)(struct rpc_task *, void *);
 	void (*rpc_release)(void *);
 };
 
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c
index 3c4f688..1eb3304 100644
--- a/net/sunrpc/stats.c
+++ b/net/sunrpc/stats.c
@@ -133,20 +133,19 @@ EXPORT_SYMBOL_GPL(rpc_free_iostats);
 /**
  * rpc_count_iostats - tally up per-task stats
  * @task: completed rpc_task
+ * @stats: array of stat structures
  *
  * Relies on the caller for serialization.
  */
-void rpc_count_iostats(struct rpc_task *task)
+void rpc_count_iostats(const struct rpc_task *task, struct rpc_iostats *stats)
 {
 	struct rpc_rqst *req = task->tk_rqstp;
-	struct rpc_iostats *stats;
 	struct rpc_iostats *op_metrics;
 	ktime_t delta;
 
-	if (!task->tk_client || !task->tk_client->cl_metrics || !req)
+	if (!stats || !req)
 		return;
 
-	stats = task->tk_client->cl_metrics;
 	op_metrics = &stats[task->tk_msg.rpc_proc->p_statidx];
 
 	op_metrics->om_ops++;
@@ -164,6 +163,7 @@ void rpc_count_iostats(struct rpc_task *task)
 	delta = ktime_sub(ktime_get(), task->tk_start);
 	op_metrics->om_execute = ktime_add(op_metrics->om_execute, delta);
 }
+EXPORT_SYMBOL_GPL(rpc_count_iostats);
 
 static void _print_name(struct seq_file *seq, unsigned int op,
 			struct rpc_procinfo *procs)
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index efe5495..100b469 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -1132,7 +1132,10 @@ void xprt_release(struct rpc_task *task)
 		return;
 
 	xprt = req->rq_xprt;
-	rpc_count_iostats(task);
+	if (task->tk_ops->rpc_count_stats != NULL)
+		task->tk_ops->rpc_count_stats(task, task->tk_calldata);
+	else if (task->tk_client)
+		rpc_count_iostats(task, task->tk_client->cl_metrics);
 	spin_lock_bh(&xprt->transport_lock);
 	xprt->ops->release_xprt(xprt, task);
 	if (xprt->ops->release_request)
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [PATCH] NFS: include filelayout DS rpc stats in mountstats
  2012-02-16 21:01     ` Myklebust, Trond
@ 2012-02-16 21:08       ` Adamson, Dros
  0 siblings, 0 replies; 23+ messages in thread
From: Adamson, Dros @ 2012-02-16 21:08 UTC (permalink / raw)
  To: Myklebust, Trond; +Cc: Adamson, Dros, linux-nfs

[-- Attachment #1: Type: text/plain, Size: 2160 bytes --]


On Feb 16, 2012, at 4:01 PM, Myklebust, Trond wrote:

> On Thu, 2012-02-16 at 20:44 +0000, Adamson, Dros wrote:
>> On Feb 16, 2012, at 2:48 PM, Myklebust, Trond wrote:
>>>    2. Shouldn't we be calling _either_ rpc_count_iostats(), _or_
>>>       task->tk_ops->rpc_count_stats()? As far as I can see, the
>>>       nfsstat output will now be double-counting and pNFS reads,
>>>       writes and commits that are sent to the DS.
>> 
>> 
>> No, this doesn't double count with nfsstats.  nfsstats uses rpc_clnt::cl_stats (and not rpc_clnt::cl_metrics).
>> 
>> I probably should have done an if/else for this patch -- with the current code, the DSs' rpc_clnt:cl_metrics will never be used.
>> I left it accumulating here because we want to have per-DS stats eventually and my plan was to print out stats in /proc/fs/nfsfs per *client* (so not separated by mountpoint).
>> 
>> I can repost with if/else, but looking at this some more made me realize that we are *still* doing this wrong :)
>> 
>> The callback method in this patch fails to accumulate stats for operations to the DS other than read/write/commit -- that seems right, but what about null, exchange_id, session heartbeats, etc?
>> 
>> In order to properly accumulate those we are back to two obvious choices:
>>  1) add a count_iostats callback to the ~25 other rpc_call_ops in nfs-land (yuck)
>>  2) add an 'additional stats' pointer to the rpc_task structure (trond already said you don't want to add to task struct)
>> 
>> Or do we just not care about displaying those operations?  For my purposes (nfsometer perf testing), it'd be nice to have *all* of the operations.
> 
> As far as I'm concerned, the administrative traffic to the DS should not
> be accounted for in the mountstats: that would be wrong since DSes can
> be shared not only by different filesystems but even by different MDSes.
> 
> So the performance overhead of lease and session setup to the DSes needs
> to be accounted for by some other mechanism.

Fair enough.  The per-client stats should help me with that.

I'll repost with if/else and change it back with the next stats patch.

-dros

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 1374 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] NFS: include filelayout DS rpc stats in mountstats
  2012-02-16 20:44   ` Adamson, Dros
  2012-02-16 20:56     ` Adamson, Dros
@ 2012-02-16 21:01     ` Myklebust, Trond
  2012-02-16 21:08       ` Adamson, Dros
  1 sibling, 1 reply; 23+ messages in thread
From: Myklebust, Trond @ 2012-02-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ZSBuaWNlIHRvIGhhdmUgKmFsbCogb2YgdGhlIG9wZXJhdGlvbnMuDQoNCkFzIGZhciBh
cyBJJ20gY29uY2VybmVkLCB0aGUgYWRtaW5pc3RyYXRpdmUgdHJhZmZpYyB0byB0aGUgRFMgc2hv
dWxkIG5vdA0KYmUgYWNjb3VudGVkIGZvciBpbiB0aGUgbW91bnRzdGF0czogdGhhdCB3b3VsZCBi
ZSB3cm9uZyBzaW5jZSBEU2VzIGNhbg0KYmUgc2hhcmVkIG5vdCBvbmx5IGJ5IGRpZmZlcmVudCBm
aWxlc3lzdGVtcyBidXQgZXZlbiBieSBkaWZmZXJlbnQgTURTZXMuDQoNClNvIHRoZSBwZXJmb3Jt
YW5jZSBvdmVyaGVhZCBvZiBsZWFzZSBhbmQgc2Vzc2lvbiBzZXR1cCB0byB0aGUgRFNlcyBuZWVk
cw0KdG8gYmUgYWNjb3VudGVkIGZvciBieSBzb21lIG90aGVyIG1lY2hhbmlzbS4NCg0KLS0gDQpU
cm9uZCBNeWtsZWJ1c3QNCkxpbnV4IE5GUyBjbGllbnQgbWFpbnRhaW5lcg0KDQpOZXRBcHANClRy
b25kLk15a2xlYnVzdEBuZXRhcHAuY29tDQp3d3cubmV0YXBwLmNvbQ0KDQo=

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] NFS: include filelayout DS rpc stats in mountstats
  2012-02-16 20:44   ` Adamson, Dros
@ 2012-02-16 20:56     ` Adamson, Dros
  2012-02-16 21:01     ` Myklebust, Trond
  1 sibling, 0 replies; 23+ messages in thread
From: Adamson, Dros @ 2012-02-16 20:56 UTC (permalink / raw)
  To: Myklebust, Trond; +Cc: linux-nfs list, Adamson, Dros

[-- Attachment #1: Type: text/plain, Size: 2763 bytes --]


On Feb 16, 2012, at 3:44 PM, Adamson, Dros wrote:

> 
> On Feb 16, 2012, at 2:48 PM, Myklebust, Trond wrote:
> 
>> On Mon, 2012-02-13 at 17:22 -0500, Weston Andros Adamson wrote:
>>> diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
>>> index efe5495..ab7a28f 100644
>>> --- a/net/sunrpc/xprt.c
>>> +++ b/net/sunrpc/xprt.c
>>> @@ -1132,7 +1132,10 @@ void xprt_release(struct rpc_task *task)
>>> 		return;
>>> 
>>> 	xprt = req->rq_xprt;
>>> -	rpc_count_iostats(task);
>>> +	if (task->tk_client)
>>> +		rpc_count_iostats(task, task->tk_client->cl_metrics);
>>> +	if (task->tk_ops->rpc_count_stats != NULL)
>>> +		task->tk_ops->rpc_count_stats(task, task->tk_calldata);
>>> 	spin_lock_bh(&xprt->transport_lock);
>>> 	xprt->ops->release_xprt(xprt, task);
>>> 	if (xprt->ops->release_request)
>> 
>> 2 nits:
>> 
>>    1. Aren't we guaranteed that task->tk_client != NULL in
>>       xprt_release()?
> 
> I wasn't sure -- there is no other reference to tk_client in the xprt_release() path.
> It worked fine for *me* without the if statement, but the old rpc_count_iostats (of which this was the only caller) checked if tk_client was NULL and I didn't want to break anything.
> 
>>    2. Shouldn't we be calling _either_ rpc_count_iostats(), _or_
>>       task->tk_ops->rpc_count_stats()? As far as I can see, the
>>       nfsstat output will now be double-counting and pNFS reads,
>>       writes and commits that are sent to the DS.
> 
> 
> No, this doesn't double count with nfsstats.  nfsstats uses rpc_clnt::cl_stats (and not rpc_clnt::cl_metrics).
> 
> I probably should have done an if/else for this patch -- with the current code, the DSs' rpc_clnt:cl_metrics will never be used.
> I left it accumulating here because we want to have per-DS stats eventually and my plan was to print out stats in /proc/fs/nfsfs per *client* (so not separated by mountpoint).
> 
> I can repost with if/else, but looking at this some more made me realize that we are *still* doing this wrong :)
> 
> The callback method in this patch fails to accumulate stats for operations to the DS other than read/write/commit -- that seems right, but what about null, exchange_id, session heartbeats, etc?
> 
> In order to properly accumulate those we are back to two obvious choices:
>  1) add a count_iostats callback to the ~25 other rpc_call_ops in nfs-land (yuck)

^^ i guess it wouldn't have to be all of them, but this gets ugly quick.

>  2) add an 'additional stats' pointer to the rpc_task structure (trond already said you don't want to add to task struct)
> 
> Or do we just not care about displaying those operations?  For my purposes (nfsometer perf testing), it'd be nice to have *all* of the operations.
> 
> -dros


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 1374 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] NFS: include filelayout DS rpc stats in mountstats
  2012-02-16 19:48 ` Myklebust, Trond
@ 2012-02-16 20:44   ` Adamson, Dros
  2012-02-16 20:56     ` Adamson, Dros
  2012-02-16 21:01     ` Myklebust, Trond
  0 siblings, 2 replies; 23+ messages in thread
From: Adamson, Dros @ 2012-02-16 20:44 UTC (permalink / raw)
  To: Myklebust, Trond; +Cc: Adamson, Dros, linux-nfs

[-- Attachment #1: Type: text/plain, Size: 2558 bytes --]


On Feb 16, 2012, at 2:48 PM, Myklebust, Trond wrote:

> On Mon, 2012-02-13 at 17:22 -0500, Weston Andros Adamson wrote:
>> diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
>> index efe5495..ab7a28f 100644
>> --- a/net/sunrpc/xprt.c
>> +++ b/net/sunrpc/xprt.c
>> @@ -1132,7 +1132,10 @@ void xprt_release(struct rpc_task *task)
>> 		return;
>> 
>> 	xprt = req->rq_xprt;
>> -	rpc_count_iostats(task);
>> +	if (task->tk_client)
>> +		rpc_count_iostats(task, task->tk_client->cl_metrics);
>> +	if (task->tk_ops->rpc_count_stats != NULL)
>> +		task->tk_ops->rpc_count_stats(task, task->tk_calldata);
>> 	spin_lock_bh(&xprt->transport_lock);
>> 	xprt->ops->release_xprt(xprt, task);
>> 	if (xprt->ops->release_request)
> 
> 2 nits:
> 
>     1. Aren't we guaranteed that task->tk_client != NULL in
>        xprt_release()?

I wasn't sure -- there is no other reference to tk_client in the xprt_release() path.
It worked fine for *me* without the if statement, but the old rpc_count_iostats (of which this was the only caller) checked if tk_client was NULL and I didn't want to break anything.

>     2. Shouldn't we be calling _either_ rpc_count_iostats(), _or_
>        task->tk_ops->rpc_count_stats()? As far as I can see, the
>        nfsstat output will now be double-counting and pNFS reads,
>        writes and commits that are sent to the DS.


No, this doesn't double count with nfsstats.  nfsstats uses rpc_clnt::cl_stats (and not rpc_clnt::cl_metrics).

I probably should have done an if/else for this patch -- with the current code, the DSs' rpc_clnt:cl_metrics will never be used.
I left it accumulating here because we want to have per-DS stats eventually and my plan was to print out stats in /proc/fs/nfsfs per *client* (so not separated by mountpoint).

I can repost with if/else, but looking at this some more made me realize that we are *still* doing this wrong :)

The callback method in this patch fails to accumulate stats for operations to the DS other than read/write/commit -- that seems right, but what about null, exchange_id, session heartbeats, etc?

In order to properly accumulate those we are back to two obvious choices:
  1) add a count_iostats callback to the ~25 other rpc_call_ops in nfs-land (yuck)
  2) add an 'additional stats' pointer to the rpc_task structure (trond already said you don't want to add to task struct)

Or do we just not care about displaying those operations?  For my purposes (nfsometer perf testing), it'd be nice to have *all* of the operations.

-dros

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 1374 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [PATCH] NFS: include filelayout DS rpc stats in mountstats
  2012-02-13 22:22 Weston Andros Adamson
@ 2012-02-16 19:48 ` Myklebust, Trond
  2012-02-16 20:44   ` Adamson, Dros
  0 siblings, 1 reply; 23+ messages in thread
From: Myklebust, Trond @ 2012-02-16 19:48 UTC (permalink / raw)
  To: Adamson, Dros; +Cc: linux-nfs

T24gTW9uLCAyMDEyLTAyLTEzIGF0IDE3OjIyIC0wNTAwLCBXZXN0b24gQW5kcm9zIEFkYW1zb24g
d3JvdGU6DQo+IGRpZmYgLS1naXQgYS9uZXQvc3VucnBjL3hwcnQuYyBiL25ldC9zdW5ycGMveHBy
dC5jDQo+IGluZGV4IGVmZTU0OTUuLmFiN2EyOGYgMTAwNjQ0DQo+IC0tLSBhL25ldC9zdW5ycGMv
eHBydC5jDQo+ICsrKyBiL25ldC9zdW5ycGMveHBydC5jDQo+IEBAIC0xMTMyLDcgKzExMzIsM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0KQ2hl
ZXJzDQogIFRyb25kDQoNCi0tIA0KVHJvbmQgTXlrbGVidXN0DQpMaW51eCBORlMgY2xpZW50IG1h
aW50YWluZXINCg0KTmV0QXBwDQpUcm9uZC5NeWtsZWJ1c3RAbmV0YXBwLmNvbQ0Kd3d3Lm5ldGFw
cC5jb20NCg0K

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [PATCH] NFS: include filelayout DS rpc stats in mountstats
@ 2012-02-13 22:22 Weston Andros Adamson
  2012-02-16 19:48 ` Myklebust, Trond
  0 siblings, 1 reply; 23+ messages in thread
From: Weston Andros Adamson @ 2012-02-13 22:22 UTC (permalink / raw)
  To: Trond.Myklebust; +Cc: linux-nfs, Weston Andros Adamson

Include RPC statistics from all data servers in /proc/self/mountstats for pNFS
filelayout mounts.

Signed-off-by: Weston Andros Adamson <dros@netapp.com>
---
Cleaned up version after comments from Trond.  This patch accumulates 
reads, writes and commits (the only DS operations) on the rpc_iostats of 
the nfs_server associated with the mount.

I was confused last week about where we breaking counting stats only for a 
mountpoint -- What I was seeing was two mounts sharing stats if they were the
same server AND the same filesystem on the server.  This patch does not address
that issue.

This patch still counts DS operations on the DS::nfs_client::rpc_clnt's stats
structures.  Assuming this patch is OK, I plan on submitting a patch that will 
show MDS-only and individual DS stats somewhere in /proc/fs/nfsfs/.

 fs/nfs/nfs4filelayout.c        |   19 +++++++++++++++++++
 include/linux/sunrpc/metrics.h |    6 ++++--
 include/linux/sunrpc/sched.h   |    1 +
 net/sunrpc/stats.c             |    8 ++++----
 net/sunrpc/xprt.c              |    5 ++++-
 5 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/fs/nfs/nfs4filelayout.c b/fs/nfs/nfs4filelayout.c
index 79be7ac..47e8f34 100644
--- a/fs/nfs/nfs4filelayout.c
+++ b/fs/nfs/nfs4filelayout.c
@@ -33,6 +33,8 @@
 #include <linux/nfs_page.h>
 #include <linux/module.h>
 
+#include <linux/sunrpc/metrics.h>
+
 #include "internal.h"
 #include "nfs4filelayout.h"
 
@@ -189,6 +191,13 @@ static void filelayout_read_call_done(struct rpc_task *task, void *data)
 	rdata->mds_ops->rpc_call_done(task, data);
 }
 
+static void filelayout_read_count_stats(struct rpc_task *task, void *data)
+{
+	struct nfs_read_data *rdata = (struct nfs_read_data *)data;
+
+	rpc_count_iostats(task, NFS_SERVER(rdata->inode)->client->cl_metrics);
+}
+
 static void filelayout_read_release(void *data)
 {
 	struct nfs_read_data *rdata = (struct nfs_read_data *)data;
@@ -268,6 +277,13 @@ static void filelayout_write_call_done(struct rpc_task *task, void *data)
 	wdata->mds_ops->rpc_call_done(task, data);
 }
 
+static void filelayout_write_count_stats(struct rpc_task *task, void *data)
+{
+	struct nfs_write_data *wdata = (struct nfs_write_data *)data;
+
+	rpc_count_iostats(task, NFS_SERVER(wdata->inode)->client->cl_metrics);
+}
+
 static void filelayout_write_release(void *data)
 {
 	struct nfs_write_data *wdata = (struct nfs_write_data *)data;
@@ -288,18 +304,21 @@ static void filelayout_commit_release(void *data)
 struct rpc_call_ops filelayout_read_call_ops = {
 	.rpc_call_prepare = filelayout_read_prepare,
 	.rpc_call_done = filelayout_read_call_done,
+	.rpc_count_stats = filelayout_read_count_stats,
 	.rpc_release = filelayout_read_release,
 };
 
 struct rpc_call_ops filelayout_write_call_ops = {
 	.rpc_call_prepare = filelayout_write_prepare,
 	.rpc_call_done = filelayout_write_call_done,
+	.rpc_count_stats = filelayout_write_count_stats,
 	.rpc_release = filelayout_write_release,
 };
 
 struct rpc_call_ops filelayout_commit_call_ops = {
 	.rpc_call_prepare = filelayout_write_prepare,
 	.rpc_call_done = filelayout_write_call_done,
+	.rpc_count_stats = filelayout_write_count_stats,
 	.rpc_release = filelayout_commit_release,
 };
 
diff --git a/include/linux/sunrpc/metrics.h b/include/linux/sunrpc/metrics.h
index b6edbc0..1565bbe 100644
--- a/include/linux/sunrpc/metrics.h
+++ b/include/linux/sunrpc/metrics.h
@@ -74,14 +74,16 @@ struct rpc_clnt;
 #ifdef CONFIG_PROC_FS
 
 struct rpc_iostats *	rpc_alloc_iostats(struct rpc_clnt *);
-void			rpc_count_iostats(struct rpc_task *);
+void			rpc_count_iostats(const struct rpc_task *,
+					  struct rpc_iostats *);
 void			rpc_print_iostats(struct seq_file *, struct rpc_clnt *);
 void			rpc_free_iostats(struct rpc_iostats *);
 
 #else  /*  CONFIG_PROC_FS  */
 
 static inline struct rpc_iostats *rpc_alloc_iostats(struct rpc_clnt *clnt) { return NULL; }
-static inline void rpc_count_iostats(struct rpc_task *task) {}
+static inline void rpc_count_iostats(const struct rpc_task *task,
+				     struct rpc_iostats *stats) {}
 static inline void rpc_print_iostats(struct seq_file *seq, struct rpc_clnt *clnt) {}
 static inline void rpc_free_iostats(struct rpc_iostats *stats) {}
 
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 22dfc24..dc0c3cc 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -103,6 +103,7 @@ typedef void			(*rpc_action)(struct rpc_task *);
 struct rpc_call_ops {
 	void (*rpc_call_prepare)(struct rpc_task *, void *);
 	void (*rpc_call_done)(struct rpc_task *, void *);
+	void (*rpc_count_stats)(struct rpc_task *, void *);
 	void (*rpc_release)(void *);
 };
 
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c
index 3c4f688..1eb3304 100644
--- a/net/sunrpc/stats.c
+++ b/net/sunrpc/stats.c
@@ -133,20 +133,19 @@ EXPORT_SYMBOL_GPL(rpc_free_iostats);
 /**
  * rpc_count_iostats - tally up per-task stats
  * @task: completed rpc_task
+ * @stats: array of stat structures
  *
  * Relies on the caller for serialization.
  */
-void rpc_count_iostats(struct rpc_task *task)
+void rpc_count_iostats(const struct rpc_task *task, struct rpc_iostats *stats)
 {
 	struct rpc_rqst *req = task->tk_rqstp;
-	struct rpc_iostats *stats;
 	struct rpc_iostats *op_metrics;
 	ktime_t delta;
 
-	if (!task->tk_client || !task->tk_client->cl_metrics || !req)
+	if (!stats || !req)
 		return;
 
-	stats = task->tk_client->cl_metrics;
 	op_metrics = &stats[task->tk_msg.rpc_proc->p_statidx];
 
 	op_metrics->om_ops++;
@@ -164,6 +163,7 @@ void rpc_count_iostats(struct rpc_task *task)
 	delta = ktime_sub(ktime_get(), task->tk_start);
 	op_metrics->om_execute = ktime_add(op_metrics->om_execute, delta);
 }
+EXPORT_SYMBOL_GPL(rpc_count_iostats);
 
 static void _print_name(struct seq_file *seq, unsigned int op,
 			struct rpc_procinfo *procs)
diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
index efe5495..ab7a28f 100644
--- a/net/sunrpc/xprt.c
+++ b/net/sunrpc/xprt.c
@@ -1132,7 +1132,10 @@ void xprt_release(struct rpc_task *task)
 		return;
 
 	xprt = req->rq_xprt;
-	rpc_count_iostats(task);
+	if (task->tk_client)
+		rpc_count_iostats(task, task->tk_client->cl_metrics);
+	if (task->tk_ops->rpc_count_stats != NULL)
+		task->tk_ops->rpc_count_stats(task, task->tk_calldata);
 	spin_lock_bh(&xprt->transport_lock);
 	xprt->ops->release_xprt(xprt, task);
 	if (xprt->ops->release_request)
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2012-02-17 19:16 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-09 16:41 [PATCH] NFS: include filelayout DS rpc stats in mountstats Weston Andros Adamson
2012-02-09 16:49 ` Chuck Lever
2012-02-09 16:59   ` Adamson, Dros
2012-02-09 18:16 ` Myklebust, Trond
2012-02-09 19:13   ` Adamson, Dros
2012-02-09 19:27     ` Myklebust, Trond
2012-02-09 19:48       ` Adamson, Dros
2012-02-09 19:58         ` Myklebust, Trond
2012-02-09 20:23           ` Adamson, Dros
2012-02-09 20:37             ` Myklebust, Trond
2012-02-09 20:47               ` Adamson, Dros
2012-02-09 20:00         ` Myklebust, Trond
2012-02-13 22:22 Weston Andros Adamson
2012-02-16 19:48 ` Myklebust, Trond
2012-02-16 20:44   ` Adamson, Dros
2012-02-16 20:56     ` Adamson, Dros
2012-02-16 21:01     ` Myklebust, Trond
2012-02-16 21:08       ` Adamson, Dros
2012-02-17 18:15 Weston Andros Adamson
2012-02-17 18:47 ` Myklebust, Trond
2012-02-17 19:02   ` Adamson, Dros
2012-02-17 19:04     ` Myklebust, Trond
2012-02-17 19:16       ` Adamson, Dros

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.