summaryrefslogtreecommitdiffstats
path: root/sys/fs
diff options
context:
space:
mode:
authorrmacklem <rmacklem@FreeBSD.org>2011-05-04 13:36:18 +0000
committerrmacklem <rmacklem@FreeBSD.org>2011-05-04 13:36:18 +0000
commit109912f8c759bb1aff80672847bb78ce95e0de85 (patch)
tree33fae0e68f006d769c099720ec0d4fe4b4acb28e /sys/fs
parentc281a5b19811e96480cb7faf970ddd258f751ce9 (diff)
downloadFreeBSD-src-109912f8c759bb1aff80672847bb78ce95e0de85.zip
FreeBSD-src-109912f8c759bb1aff80672847bb78ce95e0de85.tar.gz
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. MFC after: 2 weeks
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/nfs/nfs_commonport.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/sys/fs/nfs/nfs_commonport.c b/sys/fs/nfs/nfs_commonport.c
index 2073d26..ee37cbc 100644
--- a/sys/fs/nfs/nfs_commonport.c
+++ b/sys/fs/nfs/nfs_commonport.c
@@ -404,6 +404,64 @@ nfssvc_call(struct thread *p, struct nfssvc_args *uap, struct ucred *cred)
} 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;
OpenPOWER on IntegriCloud