All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Shankar Anand" <shanand@novell.com>
To: <nfs@lists.sourceforge.net>
Subject: PATCH [1/2] Capture nfsv4 server operations statistics
Date: Tue, 16 May 2006 01:11:18 -0600	[thread overview]
Message-ID: <4469C86F.AD69.00CC.0@novell.com> (raw)
In-Reply-To: 4469C82B.AD69.00CC.0@novell.com

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

This patch adds a nfs4 operations count array to nfsd_stats structure.
The count is  incremented in nfsd4_proc_compound() where all the
operations
are handled by the nfsv4 server. This count of individual nfsv4
operations
is also entered into /proc filesystem. 

Submitted by: Shankar Anand <shanand@novell.com>

diff -aurp linux-2.6.17-rc2.old/fs/nfsd/nfs4proc.c
linux-2.6.17-rc2/fs/nfsd/nfs4proc.c
--- linux-2.6.17-rc2.old/fs/nfsd/nfs4proc.c	2006-04-19
08:30:49.000000000 +0530
+++ linux-2.6.17-rc2/fs/nfsd/nfs4proc.c	2006-05-15
21:05:00.000000000 +0530
@@ -54,6 +54,7 @@
 #include <linux/nfsd/state.h>
 #include <linux/nfsd/xdr4.h>
 #include <linux/nfs4_acl.h>
+#include <linux/nfsd/stats.h>
 
 #define NFSDDBG_FACILITY		NFSDDBG_PROC
 
@@ -930,6 +931,10 @@ encode_op:
 		/* XXX Ugh, we need to get rid of this kind of special
case: */
 		if (op->opnum == OP_READ && op->u.read.rd_filp)
 			fput(op->u.read.rd_filp);
+		
+		/* Maintaining count for each nfsv4 operation */
+		if ( (op->opnum >= OP_ACCESS) && ( (op->opnum -
OP_ACCESS) < NFS4_NUMOPS) )
+			nfsdstats.nfs4_opcount[op->opnum -
OP_ACCESS]++;
 	}
 
 out:
diff -aurp linux-2.6.17-rc2.old/fs/nfsd/stats.c
linux-2.6.17-rc2/fs/nfsd/stats.c
--- linux-2.6.17-rc2.old/fs/nfsd/stats.c	2006-04-19
08:30:49.000000000 +0530
+++ linux-2.6.17-rc2/fs/nfsd/stats.c	2006-05-15 21:13:31.000000000
+0530
@@ -72,6 +72,12 @@ static int nfsd_proc_show(struct seq_fil
 	/* show my rpc info */
 	svc_seq_show(seq, &nfsd_svcstats);
 
+	/* show count for individual nfsv4 operations */
+	seq_printf(seq,"proc4ops %u", NFS4_NUMOPS);
+	for (i=0; i<NFS4_NUMOPS; i++)
+		seq_printf(seq, " %u", nfsdstats.nfs4_opcount[i]);
+
+	seq_putc(seq, '\n');
 	return 0;
 }
 
@@ -91,7 +97,12 @@ static const struct file_operations nfsd
 void
 nfsd_stat_init(void)
 {
+	int i;
 	svc_proc_register(&nfsd_svcstats, &nfsd_proc_fops);
+
+	/* Initialising nfsv4 operations counters */
+	for (i=0; i<NFS4_NUMOPS; i++)
+		nfsdstats.nfs4_opcount[i] = 0;
 }
 
 void
diff -aurp linux-2.6.17-rc2.old/include/linux/nfsd/stats.h
linux-2.6.17-rc2/include/linux/nfsd/stats.h
--- linux-2.6.17-rc2.old/include/linux/nfsd/stats.h	2006-04-19
08:30:49.000000000 +0530
+++ linux-2.6.17-rc2/include/linux/nfsd/stats.h	2006-05-15
18:12:30.000000000 +0530
@@ -9,6 +9,8 @@
 #ifndef LINUX_NFSD_STATS_H
 #define LINUX_NFSD_STATS_H
 
+#define NFS4_NUMOPS	37	 
+
 struct nfsd_stats {
 	unsigned int	rchits;		/* repcache hits */
 	unsigned int	rcmisses;	/* repcache hits */
@@ -27,6 +29,7 @@ struct nfsd_stats {
 	unsigned int	ra_size;	/* size of ra cache */
 	unsigned int	ra_depth[11];	/* number of times ra entry was
found that deep
 					 * in the cache (10percentiles).
[10] = not found */
+	unsigned int	nfs4_opcount[NFS4_NUMOPS];	/* count of
individual nfsv4 operations */
 };
 
 /* thread usage wraps very million seconds (approx one fortnight) */


[-- Attachment #2: linux-2.6.17-rc2-add-nfs4-server-stats.diff --]
[-- Type: text/plain, Size: 2848 bytes --]

This patch adds a nfs4 operations count array to nfsd_stats structure.
The count is  incremented in nfsd4_proc_compound() where all the operations
are handled by the nfsv4 server. This count of individual nfsv4 operations
is also entered into /proc filesystem. 

Submitted by: Shankar Anand <shanand@novell.com>

diff -aurp linux-2.6.17-rc2.old/fs/nfsd/nfs4proc.c linux-2.6.17-rc2/fs/nfsd/nfs4proc.c
--- linux-2.6.17-rc2.old/fs/nfsd/nfs4proc.c	2006-04-19 08:30:49.000000000 +0530
+++ linux-2.6.17-rc2/fs/nfsd/nfs4proc.c	2006-05-15 21:05:00.000000000 +0530
@@ -54,6 +54,7 @@
 #include <linux/nfsd/state.h>
 #include <linux/nfsd/xdr4.h>
 #include <linux/nfs4_acl.h>
+#include <linux/nfsd/stats.h>
 
 #define NFSDDBG_FACILITY		NFSDDBG_PROC
 
@@ -930,6 +931,10 @@ encode_op:
 		/* XXX Ugh, we need to get rid of this kind of special case: */
 		if (op->opnum == OP_READ && op->u.read.rd_filp)
 			fput(op->u.read.rd_filp);
+		
+		/* Maintaining count for each nfsv4 operation */
+		if ( (op->opnum >= OP_ACCESS) && ( (op->opnum - OP_ACCESS) < NFS4_NUMOPS) )
+			nfsdstats.nfs4_opcount[op->opnum - OP_ACCESS]++;
 	}
 
 out:
diff -aurp linux-2.6.17-rc2.old/fs/nfsd/stats.c linux-2.6.17-rc2/fs/nfsd/stats.c
--- linux-2.6.17-rc2.old/fs/nfsd/stats.c	2006-04-19 08:30:49.000000000 +0530
+++ linux-2.6.17-rc2/fs/nfsd/stats.c	2006-05-15 21:13:31.000000000 +0530
@@ -72,6 +72,12 @@ static int nfsd_proc_show(struct seq_fil
 	/* show my rpc info */
 	svc_seq_show(seq, &nfsd_svcstats);
 
+	/* show count for individual nfsv4 operations */
+	seq_printf(seq,"proc4ops %u", NFS4_NUMOPS);
+	for (i=0; i<NFS4_NUMOPS; i++)
+		seq_printf(seq, " %u", nfsdstats.nfs4_opcount[i]);
+
+	seq_putc(seq, '\n');
 	return 0;
 }
 
@@ -91,7 +97,12 @@ static const struct file_operations nfsd
 void
 nfsd_stat_init(void)
 {
+	int i;
 	svc_proc_register(&nfsd_svcstats, &nfsd_proc_fops);
+
+	/* Initialising nfsv4 operations counters */
+	for (i=0; i<NFS4_NUMOPS; i++)
+		nfsdstats.nfs4_opcount[i] = 0;
 }
 
 void
diff -aurp linux-2.6.17-rc2.old/include/linux/nfsd/stats.h linux-2.6.17-rc2/include/linux/nfsd/stats.h
--- linux-2.6.17-rc2.old/include/linux/nfsd/stats.h	2006-04-19 08:30:49.000000000 +0530
+++ linux-2.6.17-rc2/include/linux/nfsd/stats.h	2006-05-15 18:12:30.000000000 +0530
@@ -9,6 +9,8 @@
 #ifndef LINUX_NFSD_STATS_H
 #define LINUX_NFSD_STATS_H
 
+#define NFS4_NUMOPS	37	 
+
 struct nfsd_stats {
 	unsigned int	rchits;		/* repcache hits */
 	unsigned int	rcmisses;	/* repcache hits */
@@ -27,6 +29,7 @@ struct nfsd_stats {
 	unsigned int	ra_size;	/* size of ra cache */
 	unsigned int	ra_depth[11];	/* number of times ra entry was found that deep
 					 * in the cache (10percentiles). [10] = not found */
+	unsigned int	nfs4_opcount[NFS4_NUMOPS];	/* count of individual nfsv4 operations */
 };
 
 /* thread usage wraps very million seconds (approx one fortnight) */

       reply	other threads:[~2006-05-16  7:09 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4469C82B.AD69.00CC.0@novell.com>
2006-05-16  7:11 ` Shankar Anand [this message]
     [not found] ` <20060517213638.GE11237@fieldses.org>
2006-05-19 15:23   ` PATCH [1/2] Capture nfsv4 server operations statistics Shankar Anand
2006-05-19 16:27     ` J. Bruce Fields
2006-05-20  8:07       ` Shankar Anand
2006-05-30 14:30         ` Shankar Anand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4469C86F.AD69.00CC.0@novell.com \
    --to=shanand@novell.com \
    --cc=nfs@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.