Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 May 2011 01:14:27 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r222044 - in stable/8/sys: fs/nfs nfs
Message-ID:  <201105180114.p4I1ERZK054673@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Wed May 18 01:14:27 2011
New Revision: 222044
URL: http://svn.freebsd.org/changeset/base/222044

Log:
  MFC: r221439
  Add kernel support for NFSSVC_ZEROCLTSTATS and NFSSVC_ZEROSRVSTATS
  so that they can be used by nfsstat(1) to implement the "-z" option
  for the new NFS subsystem.

Modified:
  stable/8/sys/fs/nfs/nfs_commonport.c
  stable/8/sys/nfs/nfssvc.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/fs/nfs/nfs_commonport.c
==============================================================================
--- stable/8/sys/fs/nfs/nfs_commonport.c	Tue May 17 22:36:16 2011	(r222043)
+++ stable/8/sys/fs/nfs/nfs_commonport.c	Wed May 18 01:14:27 2011	(r222044)
@@ -404,6 +404,64 @@ nfssvc_call(struct thread *p, struct nfs
 	} else if (uap->flag & NFSSVC_GETSTATS) {
 		error = copyout(&newnfsstats,
 		    CAST_USER_ADDR_T(uap->argp), sizeof (newnfsstats));
+		if (error == 0) {
+			if ((uap->flag & NFSSVC_ZEROCLTSTATS) != 0) {
+				newnfsstats.attrcache_hits = 0;
+				newnfsstats.attrcache_misses = 0;
+				newnfsstats.lookupcache_hits = 0;
+				newnfsstats.lookupcache_misses = 0;
+				newnfsstats.direofcache_hits = 0;
+				newnfsstats.direofcache_misses = 0;
+				newnfsstats.accesscache_hits = 0;
+				newnfsstats.accesscache_misses = 0;
+				newnfsstats.biocache_reads = 0;
+				newnfsstats.read_bios = 0;
+				newnfsstats.read_physios = 0;
+				newnfsstats.biocache_writes = 0;
+				newnfsstats.write_bios = 0;
+				newnfsstats.write_physios = 0;
+				newnfsstats.biocache_readlinks = 0;
+				newnfsstats.readlink_bios = 0;
+				newnfsstats.biocache_readdirs = 0;
+				newnfsstats.readdir_bios = 0;
+				newnfsstats.rpcretries = 0;
+				newnfsstats.rpcrequests = 0;
+				newnfsstats.rpctimeouts = 0;
+				newnfsstats.rpcunexpected = 0;
+				newnfsstats.rpcinvalid = 0;
+				bzero(newnfsstats.rpccnt,
+				    sizeof(newnfsstats.rpccnt));
+			}
+			if ((uap->flag & NFSSVC_ZEROSRVSTATS) != 0) {
+				newnfsstats.srvrpc_errs = 0;
+				newnfsstats.srv_errs = 0;
+				newnfsstats.srvcache_inproghits = 0;
+				newnfsstats.srvcache_idemdonehits = 0;
+				newnfsstats.srvcache_nonidemdonehits = 0;
+				newnfsstats.srvcache_misses = 0;
+				newnfsstats.srvcache_tcppeak = 0;
+				newnfsstats.srvcache_size = 0;
+				newnfsstats.srvclients = 0;
+				newnfsstats.srvopenowners = 0;
+				newnfsstats.srvopens = 0;
+				newnfsstats.srvlockowners = 0;
+				newnfsstats.srvlocks = 0;
+				newnfsstats.srvdelegates = 0;
+				newnfsstats.clopenowners = 0;
+				newnfsstats.clopens = 0;
+				newnfsstats.cllockowners = 0;
+				newnfsstats.cllocks = 0;
+				newnfsstats.cldelegates = 0;
+				newnfsstats.cllocalopenowners = 0;
+				newnfsstats.cllocalopens = 0;
+				newnfsstats.cllocallockowners = 0;
+				newnfsstats.cllocallocks = 0;
+				bzero(newnfsstats.srvrpccnt,
+				    sizeof(newnfsstats.srvrpccnt));
+				bzero(newnfsstats.cbrpccnt,
+				    sizeof(newnfsstats.cbrpccnt));
+			}
+		}
 		return (error);
 	} else if (uap->flag & NFSSVC_NFSUSERDPORT) {
 		u_short sockport;

Modified: stable/8/sys/nfs/nfssvc.h
==============================================================================
--- stable/8/sys/nfs/nfssvc.h	Tue May 17 22:36:16 2011	(r222043)
+++ stable/8/sys/nfs/nfssvc.h	Wed May 18 01:14:27 2011	(r222044)
@@ -64,5 +64,7 @@
 #define	NFSSVC_CBADDSOCK	0x00200000
 #define	NFSSVC_GETSTATS		0x00400000
 #define	NFSSVC_BACKUPSTABLE	0x00800000
+#define	NFSSVC_ZEROCLTSTATS	0x01000000	/* modifier for GETSTATS */
+#define	NFSSVC_ZEROSRVSTATS	0x02000000	/* modifier for GETSTATS */
 
 #endif /* _NFS_NFSSVC_H */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105180114.p4I1ERZK054673>