Date: Sun, 15 Sep 2019 02:17:30 +0000 (UTC) From: Rick Macklem <rmacklem@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r352343 - projects/nfsv42/sys/fs/nfs Message-ID: <201909150217.x8F2HUIH094370@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rmacklem Date: Sun Sep 15 02:17:30 2019 New Revision: 352343 URL: https://svnweb.freebsd.org/changeset/base/352343 Log: Update the nfsstats structure. I had left slush in the NFSV42_NPROC sized arrays so that I wouldn't have to do this. But I was a dumbass and didn't leave slush in the NFSV42_NOPS arrays. I figured that since the NFSv4.2 RFC was published, that there would be no additional operations defined but RFC-8276 came along and defined four more of them. So, the nfsstats structure needed to be updated. I stuck with the nfsstatv1 name, since it only changed w.r.t. array sizes, which now have slush for all the arrays. Hopefully this won't need to be done again. Modified: projects/nfsv42/sys/fs/nfs/nfs_commonport.c projects/nfsv42/sys/fs/nfs/nfsport.h Modified: projects/nfsv42/sys/fs/nfs/nfs_commonport.c ============================================================================== --- projects/nfsv42/sys/fs/nfs/nfs_commonport.c Sun Sep 15 01:02:01 2019 (r352342) +++ projects/nfsv42/sys/fs/nfs/nfs_commonport.c Sun Sep 15 02:17:30 2019 (r352343) @@ -80,6 +80,7 @@ int nfs_pnfsio(task_fn_t *, void *); static int nfs_realign_test; static int nfs_realign_count; static struct ext_nfsstats oldnfsstats; +static struct nfsstatsov1 nfsstatsov1; SYSCTL_NODE(_vfs, OID_AUTO, nfs, CTLFLAG_RW, 0, "NFS filesystem"); SYSCTL_INT(_vfs_nfs, OID_AUTO, realign_test, CTLFLAG_RW, &nfs_realign_test, @@ -580,11 +581,143 @@ nfssvc_call(struct thread *p, struct nfssvc_args *uap, } else { error = copyin(uap->argp, &nfsstatver, sizeof(nfsstatver)); - if (error == 0 && nfsstatver.vers != NFSSTATS_V1) - error = EPERM; - if (error == 0) - error = copyout(&nfsstatsv1, uap->argp, - sizeof (nfsstatsv1)); + if (error == 0) { + if (nfsstatver.vers == NFSSTATS_OV1) { + /* Copy nfsstatsv1 to nfsstatsov1. */ + nfsstatsov1.attrcache_hits = + nfsstatsv1.attrcache_hits; + nfsstatsov1.attrcache_misses = + nfsstatsv1.attrcache_misses; + nfsstatsov1.lookupcache_hits = + nfsstatsv1.lookupcache_hits; + nfsstatsov1.lookupcache_misses = + nfsstatsv1.lookupcache_misses; + nfsstatsov1.direofcache_hits = + nfsstatsv1.direofcache_hits; + nfsstatsov1.direofcache_misses = + nfsstatsv1.direofcache_misses; + nfsstatsov1.accesscache_hits = + nfsstatsv1.accesscache_hits; + nfsstatsov1.accesscache_misses = + nfsstatsv1.accesscache_misses; + nfsstatsov1.biocache_reads = + nfsstatsv1.biocache_reads; + nfsstatsov1.read_bios = + nfsstatsv1.read_bios; + nfsstatsov1.read_physios = + nfsstatsv1.read_physios; + nfsstatsov1.biocache_writes = + nfsstatsv1.biocache_writes; + nfsstatsov1.write_bios = + nfsstatsv1.write_bios; + nfsstatsov1.write_physios = + nfsstatsv1.write_physios; + nfsstatsov1.biocache_readlinks = + nfsstatsv1.biocache_readlinks; + nfsstatsov1.readlink_bios = + nfsstatsv1.readlink_bios; + nfsstatsov1.biocache_readdirs = + nfsstatsv1.biocache_readdirs; + nfsstatsov1.readdir_bios = + nfsstatsv1.readdir_bios; + for (i = 0; i < NFSV42_NPROCS; i++) + nfsstatsov1.rpccnt[i] = + nfsstatsv1.rpccnt[i]; + nfsstatsov1.rpcretries = + nfsstatsv1.rpcretries; + for (i = 0; i < NFSV42_PURENOPS; i++) + nfsstatsov1.srvrpccnt[i] = + nfsstatsv1.srvrpccnt[i]; + for (i = NFSV42_NOPS, + j = NFSV42_PURENOPS; + i < NFSV42_NOPS + NFSV4OP_FAKENOPS; + i++, j++) + nfsstatsov1.srvrpccnt[j] = + nfsstatsv1.srvrpccnt[i]; + nfsstatsov1.srvrpc_errs = + nfsstatsv1.srvrpc_errs; + nfsstatsov1.srv_errs = + nfsstatsv1.srv_errs; + nfsstatsov1.rpcrequests = + nfsstatsv1.rpcrequests; + nfsstatsov1.rpctimeouts = + nfsstatsv1.rpctimeouts; + nfsstatsov1.rpcunexpected = + nfsstatsv1.rpcunexpected; + nfsstatsov1.rpcinvalid = + nfsstatsv1.rpcinvalid; + nfsstatsov1.srvcache_inproghits = + nfsstatsv1.srvcache_inproghits; + nfsstatsov1.srvcache_idemdonehits = + nfsstatsv1.srvcache_idemdonehits; + nfsstatsov1.srvcache_nonidemdonehits = + nfsstatsv1.srvcache_nonidemdonehits; + nfsstatsov1.srvcache_misses = + nfsstatsv1.srvcache_misses; + nfsstatsov1.srvcache_tcppeak = + nfsstatsv1.srvcache_tcppeak; + nfsstatsov1.srvcache_size = + nfsstatsv1.srvcache_size; + nfsstatsov1.srvclients = + nfsstatsv1.srvclients; + nfsstatsov1.srvopenowners = + nfsstatsv1.srvopenowners; + nfsstatsov1.srvopens = + nfsstatsv1.srvopens; + nfsstatsov1.srvlockowners = + nfsstatsv1.srvlockowners; + nfsstatsov1.srvlocks = + nfsstatsv1.srvlocks; + nfsstatsov1.srvdelegates = + nfsstatsv1.srvdelegates; + for (i = 0; i < NFSV42_CBNOPS; i++) + nfsstatsov1.cbrpccnt[i] = + nfsstatsv1.cbrpccnt[i]; + nfsstatsov1.clopenowners = + nfsstatsv1.clopenowners; + nfsstatsov1.clopens = + nfsstatsv1.clopens; + nfsstatsov1.cllockowners = + nfsstatsv1.cllockowners; + nfsstatsov1.cllocks = + nfsstatsv1.cllocks; + nfsstatsov1.cldelegates = + nfsstatsv1.cldelegates; + nfsstatsov1.cllocalopenowners = + nfsstatsv1.cllocalopenowners; + nfsstatsov1.cllocalopens = + nfsstatsv1.cllocalopens; + nfsstatsov1.cllocallockowners = + nfsstatsv1.cllocallockowners; + nfsstatsov1.cllocallocks = + nfsstatsv1.cllocallocks; + nfsstatsov1.srvstartcnt = + nfsstatsv1.srvstartcnt; + nfsstatsov1.srvdonecnt = + nfsstatsv1.srvdonecnt; + for (i = NFSV42_NOPS, + j = NFSV42_PURENOPS; + i < NFSV42_NOPS + NFSV4OP_FAKENOPS; + i++, j++) { + nfsstatsov1.srvbytes[j] = + nfsstatsv1.srvbytes[i]; + nfsstatsov1.srvops[j] = + nfsstatsv1.srvops[i]; + nfsstatsov1.srvduration[j] = + nfsstatsv1.srvduration[i]; + } + nfsstatsov1.busyfrom = + nfsstatsv1.busyfrom; + nfsstatsov1.busyfrom = + nfsstatsv1.busyfrom; + error = copyout(&nfsstatsov1, uap->argp, + sizeof(nfsstatsov1)); + } else if (nfsstatver.vers != NFSSTATS_V1) + error = EPERM; + else + error = copyout(&nfsstatsv1, uap->argp, + sizeof(nfsstatsv1)); + } } if (error == 0) { if ((uap->flag & NFSSVC_ZEROCLTSTATS) != 0) { Modified: projects/nfsv42/sys/fs/nfs/nfsport.h ============================================================================== --- projects/nfsv42/sys/fs/nfs/nfsport.h Sun Sep 15 01:02:01 2019 (r352342) +++ projects/nfsv42/sys/fs/nfs/nfsport.h Sun Sep 15 02:17:30 2019 (r352343) @@ -277,6 +277,9 @@ #define NFSV4OP_WRITESAME 70 #define NFSV4OP_CLONE 71 +/* One greater than the last Operation # defined in RFC-7862. */ +#define NFSV42_PURENOPS 72 + /* and the optional Extended attribute operations (RFC-8276). */ #define NFSV4OP_GETXATTR 72 #define NFSV4OP_SETXATTR 73 @@ -420,10 +423,10 @@ #endif /* NFS_V3NPROCS */ /* - * New stats structure. + * Newest stats structure. * The vers field will be set to NFSSTATS_V1 by the caller. */ -#define NFSSTATS_V1 1 +#define NFSSTATS_V1 2 struct nfsstatsv1 { int vers; /* Set to version requested by caller. */ uint64_t attrcache_hits; @@ -444,9 +447,74 @@ struct nfsstatsv1 { uint64_t readlink_bios; uint64_t biocache_readdirs; uint64_t readdir_bios; + uint64_t rpccnt[NFSV42_NPROCS + 15]; + uint64_t rpcretries; + uint64_t srvrpccnt[NFSV42_NOPS + NFSV4OP_FAKENOPS + 15]; + uint64_t srvrpc_errs; + uint64_t srv_errs; + uint64_t rpcrequests; + uint64_t rpctimeouts; + uint64_t rpcunexpected; + uint64_t rpcinvalid; + uint64_t srvcache_inproghits; + uint64_t srvcache_idemdonehits; + uint64_t srvcache_nonidemdonehits; + uint64_t srvcache_misses; + uint64_t srvcache_tcppeak; + int srvcache_size; /* Updated by atomic_xx_int(). */ + uint64_t srvclients; + uint64_t srvopenowners; + uint64_t srvopens; + uint64_t srvlockowners; + uint64_t srvlocks; + uint64_t srvdelegates; + uint64_t cbrpccnt[NFSV42_CBNOPS + 10]; + uint64_t clopenowners; + uint64_t clopens; + uint64_t cllockowners; + uint64_t cllocks; + uint64_t cldelegates; + uint64_t cllocalopenowners; + uint64_t cllocalopens; + uint64_t cllocallockowners; + uint64_t cllocallocks; + uint64_t srvstartcnt; + uint64_t srvdonecnt; + uint64_t srvbytes[NFSV42_NOPS + NFSV4OP_FAKENOPS + 15]; + uint64_t srvops[NFSV42_NOPS + NFSV4OP_FAKENOPS + 15]; + struct bintime srvduration[NFSV42_NOPS + NFSV4OP_FAKENOPS + 15]; + struct bintime busyfrom; + struct bintime busytime; +}; + +/* + * Newer stats structure. + * The vers field will be set to NFSSTATS_OV1 by the caller. + */ +#define NFSSTATS_OV1 1 +struct nfsstatsov1 { + int vers; /* Set to version requested by caller. */ + uint64_t attrcache_hits; + uint64_t attrcache_misses; + uint64_t lookupcache_hits; + uint64_t lookupcache_misses; + uint64_t direofcache_hits; + uint64_t direofcache_misses; + uint64_t accesscache_hits; + uint64_t accesscache_misses; + uint64_t biocache_reads; + uint64_t read_bios; + uint64_t read_physios; + uint64_t biocache_writes; + uint64_t write_bios; + uint64_t write_physios; + uint64_t biocache_readlinks; + uint64_t readlink_bios; + uint64_t biocache_readdirs; + uint64_t readdir_bios; uint64_t rpccnt[NFSV42_NPROCS + 4]; uint64_t rpcretries; - uint64_t srvrpccnt[NFSV42_NOPS + NFSV4OP_FAKENOPS]; + uint64_t srvrpccnt[NFSV42_PURENOPS + NFSV4OP_FAKENOPS]; uint64_t srvrpc_errs; uint64_t srv_errs; uint64_t rpcrequests; @@ -477,9 +545,9 @@ struct nfsstatsv1 { uint64_t cllocallocks; uint64_t srvstartcnt; uint64_t srvdonecnt; - uint64_t srvbytes[NFSV42_NOPS + NFSV4OP_FAKENOPS]; - uint64_t srvops[NFSV42_NOPS + NFSV4OP_FAKENOPS]; - struct bintime srvduration[NFSV42_NOPS + NFSV4OP_FAKENOPS]; + uint64_t srvbytes[NFSV42_PURENOPS + NFSV4OP_FAKENOPS]; + uint64_t srvops[NFSV42_PURENOPS + NFSV4OP_FAKENOPS]; + struct bintime srvduration[NFSV42_PURENOPS + NFSV4OP_FAKENOPS]; struct bintime busyfrom; struct bintime busytime; };
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909150217.x8F2HUIH094370>