* PATCH [1/2] Capture nfsv4 server operations statistics [not found] <4469C82B.AD69.00CC.0@novell.com> @ 2006-05-16 7:11 ` Shankar Anand [not found] ` <20060517213638.GE11237@fieldses.org> 1 sibling, 0 replies; 5+ messages in thread From: Shankar Anand @ 2006-05-16 7:11 UTC (permalink / raw) To: nfs [-- 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) */ ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <20060517213638.GE11237@fieldses.org>]
* Re: PATCH [1/2] Capture nfsv4 server operations statistics [not found] ` <20060517213638.GE11237@fieldses.org> @ 2006-05-19 15:23 ` Shankar Anand 2006-05-19 16:27 ` J. Bruce Fields 0 siblings, 1 reply; 5+ messages in thread From: Shankar Anand @ 2006-05-19 15:23 UTC (permalink / raw) To: J. Fields, nfsv4, nfs [-- Attachment #1: Type: text/plain, Size: 1229 bytes --] Hi, Attaching the new patch with changes according to Bruce's comments. > On 5/18/2006 at 3:06:38 am "J. Bruce Fields" <bfields@fieldses.org> wrote: > On Tue, May 16, 2006 at 01:10:10AM -0600, Shankar Anand wrote: >> 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> > > Note that should be "Signed-off-by:"; see the "Developer's Certificate > of Origin" in Documentation/SubmittingPatches. Changed. >> @@ -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; >> } > > Hm. Have you checked whether this compiles when NFSv4 is > configured out? Verified compilation when nfsv4 is configured out. And also made changes so that the nfsv4 operation statistics are captured only when nfsv4 is configured. [-- Attachment #2: linux-2.6.17-rc2-add-nfs4-server-stats.diff --] [-- Type: text/plain, Size: 2963 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. Signed-off-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-20 01:51:27.000000000 +0530 @@ -72,6 +72,14 @@ static int nfsd_proc_show(struct seq_fil /* show my rpc info */ svc_seq_show(seq, &nfsd_svcstats); +#ifdef CONFIG_NFS_V4 + /* 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'); +#endif return 0; } @@ -91,6 +99,12 @@ static const struct file_operations nfsd void nfsd_stat_init(void) { +#ifdef CONFIG_NFS_V4 + int i; + /* Initialising nfsv4 operations counters */ + for (i=0; i<NFS4_NUMOPS; i++) + nfsdstats.nfs4_opcount[i] = 0; +#endif svc_proc_register(&nfsd_svcstats, &nfsd_proc_fops); } 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-20 01:47:42.000000000 +0530 @@ -9,6 +9,10 @@ #ifndef LINUX_NFSD_STATS_H #define LINUX_NFSD_STATS_H +#ifdef CONFIG_NFSD_V4 +#define NFS4_NUMOPS 37 +#endif + struct nfsd_stats { unsigned int rchits; /* repcache hits */ unsigned int rcmisses; /* repcache hits */ @@ -27,6 +31,9 @@ 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 */ +#ifdef CONFIG_NFSD_V4 + unsigned int nfs4_opcount[NFS4_NUMOPS]; /* count of individual nfsv4 operations */ +#endif }; /* thread usage wraps very million seconds (approx one fortnight) */ [-- Attachment #3: Type: text/plain, Size: 138 bytes --] _______________________________________________ NFSv4 mailing list NFSv4@linux-nfs.org http://linux-nfs.org/cgi-bin/mailman/listinfo/nfsv4 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PATCH [1/2] Capture nfsv4 server operations statistics 2006-05-19 15:23 ` Shankar Anand @ 2006-05-19 16:27 ` J. Bruce Fields 2006-05-20 8:07 ` Shankar Anand 0 siblings, 1 reply; 5+ messages in thread From: J. Bruce Fields @ 2006-05-19 16:27 UTC (permalink / raw) To: Shankar Anand; +Cc: nfs, nfsv4 On Fri, May 19, 2006 at 09:23:20AM -0600, Shankar Anand wrote: > Verified compilation when nfsv4 is configured out. And also > made changes so that the nfsv4 operation statistics are captured > only when nfsv4 is configured. Thanks! Looks fine to me. One last thing I wonder about--the current /proc/net/rpc/nfsd ends with lines like: proc2 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 proc3 22 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 proc4 2 4 172 where the two operations counted on the last line are NULL and COMPOUND. You're appending one more line, to make: proc2 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 proc3 22 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 proc4 2 4 172 proc4ops 37 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 I like the fact that that doesn't bother the preexisting proc4 line. On the other hand, as far as we know nobody's ever used the data on that line, and it's hard to see how they would in the future (the number of NULL calls to the server isn't very important), so may it would be simplest just to replace the proc4 line entirely, as was done on the client side. Any strong opinions from anyone else? --b. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PATCH [1/2] Capture nfsv4 server operations statistics 2006-05-19 16:27 ` J. Bruce Fields @ 2006-05-20 8:07 ` Shankar Anand 2006-05-30 14:30 ` Shankar Anand 0 siblings, 1 reply; 5+ messages in thread From: Shankar Anand @ 2006-05-20 8:07 UTC (permalink / raw) To: J. Fields; +Cc: nfsv4, nfs Hi, > On 5/19/2006 at 9:57:47 pm, > "J. Bruce Fields" <bfields@fieldses.org> wrote: > On Fri, May 19, 2006 at 09:23:20AM -0600, Shankar Anand wrote: >> Verified compilation when nfsv4 is configured out. And also=20 >> made changes so that the nfsv4 operation statistics are captured >> only when nfsv4 is configured. >=20 > Thanks! Looks fine to me. >=20 > One last thing I wonder about--the current /proc/net/rpc/nfsd ends with > lines like: >=20 > proc2 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 > proc3 22 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 > proc4 2 4 172 >=20 > where the two operations counted on the last line are NULL and COMPOUND. > You're appending one more line, to make: >=20 > proc2 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 > proc3 22 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 > proc4 2 4 172 > proc4ops 37 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 > 0 0 0 0 0 0 0 >=20 > I like the fact that that doesn't bother the preexisting proc4 line. On > the other hand, as far as we know nobody's ever used the data on that > line, and it's hard to see how they would in the future (the number of > NULL calls to the server isn't very important), so may it would be > simplest just to replace the proc4 line entirely, as was done on the > client side. >=20 > Any strong opinions from anyone else? There are some small issues in doing that. The proc2, proc3 and proc4 lines get written into the /proc file by=20 rpc_proc_show() function in sunrpc library unlike the proc4ops line = that=20 I have written now, which gets written into /proc file at nfs level in=20 nfs_proc_show(). All the procedures that are registered as rpc procedures, get their = statistics=20 recorded in the /proc file in the sunrpc rpc_proc_show() function. If = we=20 have to avoid the original proc4 line, we will have to introduce a special = case=20 to specifically refrain from writing v4 rpc statistics into the /proc = file,=20 which may not be appropriate. In the client, all the procedures are registered as rpc procedures in = nfs4xdr.c. Hence, the proc4 line for the client contains all the v4 procedures. Cheers, Shankar ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ NFS maillist - NFS@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/nfs ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: PATCH [1/2] Capture nfsv4 server operations statistics 2006-05-20 8:07 ` Shankar Anand @ 2006-05-30 14:30 ` Shankar Anand 0 siblings, 0 replies; 5+ messages in thread From: Shankar Anand @ 2006-05-30 14:30 UTC (permalink / raw) To: bfields, nfsv4, nfs Hi, > On 5/20/2006 at 1:37:34 pm, "Shankar Anand" <shanand@novell.com> wrote: > Hi, > >> On 5/19/2006 at 9:57:47 pm, >> "J. Bruce Fields" <bfields@fieldses.org> wrote: >> On Fri, May 19, 2006 at 09:23:20AM -0600, Shankar Anand wrote: >>> Verified compilation when nfsv4 is configured out. And also >>> made changes so that the nfsv4 operation statistics are captured >>> only when nfsv4 is configured. >> >> Thanks! Looks fine to me. >> >> One last thing I wonder about--the current /proc/net/rpc/nfsd ends with >> lines like: >> >> proc2 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 >> proc3 22 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 >> proc4 2 4 172 >> >> where the two operations counted on the last line are NULL and COMPOUND. >> You're appending one more line, to make: >> >> proc2 18 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 >> proc3 22 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 >> proc4 2 4 172 >> proc4ops 37 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 >> 0 0 0 0 0 0 0 >> >> I like the fact that that doesn't bother the preexisting proc4 line. On >> the other hand, as far as we know nobody's ever used the data on that >> line, and it's hard to see how they would in the future (the number of >> NULL calls to the server isn't very important), so may it would be >> simplest just to replace the proc4 line entirely, as was done on the >> client side. >> >> Any strong opinions from anyone else? > > There are some small issues in doing that. > > The proc2, proc3 and proc4 lines get written into the /proc file by > rpc_proc_show() function in sunrpc library unlike the proc4ops line that > I have written now, which gets written into /proc file at nfs level in > nfs_proc_show(). > > All the procedures that are registered as rpc procedures, get their > statistics > recorded in the /proc file in the sunrpc rpc_proc_show() function. If we > have to avoid the original proc4 line, we will have to introduce a special > case > to specifically refrain from writing v4 rpc statistics into the /proc file, > which may not be appropriate. > > In the client, all the procedures are registered as rpc procedures in > nfs4xdr.c. > Hence, the proc4 line for the client contains all the v4 procedures. Is adding the proc4ops line ok? Are these patches ok with everyone? Please get back if you have comments. Cheers, Shankar ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-05-30 14:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <4469C82B.AD69.00CC.0@novell.com>
2006-05-16 7:11 ` PATCH [1/2] Capture nfsv4 server operations statistics Shankar Anand
[not found] ` <20060517213638.GE11237@fieldses.org>
2006-05-19 15:23 ` Shankar Anand
2006-05-19 16:27 ` J. Bruce Fields
2006-05-20 8:07 ` Shankar Anand
2006-05-30 14:30 ` Shankar Anand
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.