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 <[email protected]>
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) */
Hi,
> On 5/20/2006 at 1:37:34 pm, "Shankar Anand" <[email protected]>
wrote:
> Hi,
>
>> On 5/19/2006 at 9:57:47 pm,
>> "J. Bruce Fields" <[email protected]> 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
_______________________________________________
NFSv4 mailing list
[email protected]
http://linux-nfs.org/cgi-bin/mailman/listinfo/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.
Hi,
> On 5/19/2006 at 9:57:47 pm,
> "J. Bruce Fields" <[email protected]> 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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs