aboutsummaryrefslogtreecommitdiff
path: root/sys/fs
diff options
context:
space:
mode:
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/autofs/autofs_vnops.c18
-rw-r--r--sys/fs/devfs/devfs_vnops.c69
-rw-r--r--sys/fs/ext2fs/ext2_dinode.h3
-rw-r--r--sys/fs/ext2fs/ext2fs.h12
-rw-r--r--sys/fs/fdescfs/fdesc_vnops.c2
-rw-r--r--sys/fs/msdosfs/msdosfs_vnops.c1
-rw-r--r--sys/fs/nfs/nfs_commonkrpc.c12
-rw-r--r--sys/fs/nfs/nfs_commonport.c208
-rw-r--r--sys/fs/nfs/nfsport.h104
-rw-r--r--sys/fs/nfs/nfsproto.h4
-rw-r--r--sys/fs/nfsclient/nfs_clbio.c32
-rw-r--r--sys/fs/nfsclient/nfs_clcomsubs.c6
-rw-r--r--sys/fs/nfsclient/nfs_clstate.c58
-rw-r--r--sys/fs/nfsclient/nfs_clsubs.c39
-rw-r--r--sys/fs/nfsclient/nfs_clvfsops.c1
-rw-r--r--sys/fs/nfsclient/nfs_clvnops.c36
-rw-r--r--sys/fs/nfsclient/nfsnode.h1
-rw-r--r--sys/fs/nfsserver/nfs_nfsdcache.c36
-rw-r--r--sys/fs/nfsserver/nfs_nfsdport.c5
-rw-r--r--sys/fs/nfsserver/nfs_nfsdsocket.c103
-rw-r--r--sys/fs/nfsserver/nfs_nfsdstate.c50
-rw-r--r--sys/fs/procfs/procfs_status.c2
-rw-r--r--sys/fs/pseudofs/pseudofs.c6
-rw-r--r--sys/fs/pseudofs/pseudofs.h14
-rw-r--r--sys/fs/pseudofs/pseudofs_fileno.c2
-rw-r--r--sys/fs/pseudofs/pseudofs_vncache.c2
-rw-r--r--sys/fs/smbfs/smbfs_node.c2
-rw-r--r--sys/fs/tmpfs/tmpfs_subr.c11
-rw-r--r--sys/fs/unionfs/union_vnops.c4
29 files changed, 556 insertions, 287 deletions
diff --git a/sys/fs/autofs/autofs_vnops.c b/sys/fs/autofs/autofs_vnops.c
index 781338b89605..3dfdb559e9b3 100644
--- a/sys/fs/autofs/autofs_vnops.c
+++ b/sys/fs/autofs/autofs_vnops.c
@@ -138,11 +138,9 @@ autofs_trigger_vn(struct vnode *vp, const char *path, int pathlen,
struct vnode **newvp)
{
struct autofs_node *anp;
- struct autofs_mount *amp;
int error, lock_flags;
anp = vp->v_data;
- amp = VFSTOAUTOFS(vp->v_mount);
/*
* Release the vnode lock, so that other operations, in partcular
@@ -331,6 +329,21 @@ autofs_mkdir(struct vop_mkdir_args *ap)
return (error);
}
+static int
+autofs_print(struct vop_print_args *ap)
+{
+ struct vnode *vp;
+ struct autofs_node *anp;
+
+ vp = ap->a_vp;
+ anp = vp->v_data;
+
+ printf(" name \"%s\", fileno %d, cached %d, wildcards %d\n",
+ anp->an_name, anp->an_fileno, anp->an_cached, anp->an_wildcards);
+
+ return (0);
+}
+
/*
* Write out a single 'struct dirent', based on 'name' and 'fileno' arguments.
*/
@@ -531,6 +544,7 @@ struct vop_vector autofs_vnodeops = {
.vop_link = VOP_EOPNOTSUPP,
.vop_mkdir = autofs_mkdir,
.vop_mknod = VOP_EOPNOTSUPP,
+ .vop_print = autofs_print,
.vop_read = VOP_EOPNOTSUPP,
.vop_readdir = autofs_readdir,
.vop_remove = VOP_EOPNOTSUPP,
diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c
index 7cc0f9ee0b11..03e13d0f7648 100644
--- a/sys/fs/devfs/devfs_vnops.c
+++ b/sys/fs/devfs/devfs_vnops.c
@@ -707,10 +707,11 @@ devfs_getattr(struct vop_getattr_args *ap)
{
struct vnode *vp = ap->a_vp;
struct vattr *vap = ap->a_vap;
- int error;
struct devfs_dirent *de;
struct devfs_mount *dmp;
struct cdev *dev;
+ struct timeval boottime;
+ int error;
error = devfs_populate_vp(vp);
if (error != 0)
@@ -740,6 +741,7 @@ devfs_getattr(struct vop_getattr_args *ap)
vap->va_blocksize = DEV_BSIZE;
vap->va_type = vp->v_type;
+ getboottime(&boottime);
#define fix(aa) \
do { \
if ((aa).tv_sec <= 3600) { \
@@ -779,47 +781,61 @@ devfs_getattr(struct vop_getattr_args *ap)
static int
devfs_ioctl_f(struct file *fp, u_long com, void *data, struct ucred *cred, struct thread *td)
{
- struct cdev *dev;
- struct cdevsw *dsw;
- struct vnode *vp;
- struct vnode *vpold;
- int error, i, ref;
- const char *p;
- struct fiodgname_arg *fgn;
struct file *fpop;
+ int error;
fpop = td->td_fpop;
- error = devfs_fp_check(fp, &dev, &dsw, &ref);
- if (error != 0) {
- error = vnops.fo_ioctl(fp, com, data, cred, td);
- return (error);
- }
+ td->td_fpop = fp;
+ error = vnops.fo_ioctl(fp, com, data, cred, td);
+ td->td_fpop = fpop;
+ return (error);
+}
+
+static int
+devfs_ioctl(struct vop_ioctl_args *ap)
+{
+ struct fiodgname_arg *fgn;
+ struct vnode *vpold, *vp;
+ struct cdevsw *dsw;
+ struct thread *td;
+ struct cdev *dev;
+ int error, ref, i;
+ const char *p;
+ u_long com;
+
+ vp = ap->a_vp;
+ com = ap->a_command;
+ td = ap->a_td;
+
+ dsw = devvn_refthread(vp, &dev, &ref);
+ if (dsw == NULL)
+ return (ENXIO);
+ KASSERT(dev->si_refcount > 0,
+ ("devfs: un-referenced struct cdev *(%s)", devtoname(dev)));
if (com == FIODTYPE) {
- *(int *)data = dsw->d_flags & D_TYPEMASK;
- td->td_fpop = fpop;
- dev_relthread(dev, ref);
- return (0);
+ *(int *)ap->a_data = dsw->d_flags & D_TYPEMASK;
+ error = 0;
+ goto out;
} else if (com == FIODGNAME) {
- fgn = data;
+ fgn = ap->a_data;
p = devtoname(dev);
i = strlen(p) + 1;
if (i > fgn->len)
error = EINVAL;
else
error = copyout(p, fgn->buf, i);
- td->td_fpop = fpop;
- dev_relthread(dev, ref);
- return (error);
+ goto out;
}
- error = dsw->d_ioctl(dev, com, data, fp->f_flag, td);
- td->td_fpop = NULL;
+
+ error = dsw->d_ioctl(dev, com, ap->a_data, ap->a_fflag, td);
+
+out:
dev_relthread(dev, ref);
if (error == ENOIOCTL)
error = ENOTTY;
- if (error == 0 && com == TIOCSCTTY) {
- vp = fp->f_vnode;
+ if (error == 0 && com == TIOCSCTTY) {
/* Do nothing if reassigning same control tty */
sx_slock(&proctree_lock);
if (td->td_proc->p_session->s_ttyvp == vp) {
@@ -1862,6 +1878,7 @@ static struct fileops devfs_ops_f = {
.fo_flags = DFLAG_PASSABLE | DFLAG_SEEKABLE
};
+/* Vops for non-CHR vnodes in /dev. */
static struct vop_vector devfs_vnodeops = {
.vop_default = &default_vnodeops,
@@ -1885,6 +1902,7 @@ static struct vop_vector devfs_vnodeops = {
.vop_vptocnp = devfs_vptocnp,
};
+/* Vops for VCHR vnodes in /dev. */
static struct vop_vector devfs_specops = {
.vop_default = &default_vnodeops,
@@ -1894,6 +1912,7 @@ static struct vop_vector devfs_specops = {
.vop_create = VOP_PANIC,
.vop_fsync = devfs_fsync,
.vop_getattr = devfs_getattr,
+ .vop_ioctl = devfs_ioctl,
.vop_link = VOP_PANIC,
.vop_mkdir = VOP_PANIC,
.vop_mknod = VOP_PANIC,
diff --git a/sys/fs/ext2fs/ext2_dinode.h b/sys/fs/ext2fs/ext2_dinode.h
index a172a5b6f84b..35904616165d 100644
--- a/sys/fs/ext2fs/ext2_dinode.h
+++ b/sys/fs/ext2fs/ext2_dinode.h
@@ -71,7 +71,10 @@
#define EXT4_TOPDIR 0x00020000 /* Top of directory hierarchies*/
#define EXT4_HUGE_FILE 0x00040000 /* Set to each huge file */
#define EXT4_EXTENTS 0x00080000 /* Inode uses extents */
+#define EXT4_EA_INODE 0x00200000 /* Inode used for large EA */
#define EXT4_EOFBLOCKS 0x00400000 /* Blocks allocated beyond EOF */
+#define EXT4_INLINE_DATA 0x10000000 /* Inode has inline data */
+#define EXT4_PROJINHERIT 0x20000000 /* Children inherit project ID */
/*
* Definitions for nanosecond timestamps.
diff --git a/sys/fs/ext2fs/ext2fs.h b/sys/fs/ext2fs/ext2fs.h
index b005ddd5be2e..b0258bd71ba1 100644
--- a/sys/fs/ext2fs/ext2fs.h
+++ b/sys/fs/ext2fs/ext2fs.h
@@ -206,6 +206,7 @@ struct csum {
#define EXT2F_COMPAT_HASJOURNAL 0x0004
#define EXT2F_COMPAT_RESIZE 0x0010
#define EXT2F_COMPAT_DIRHASHINDEX 0x0020
+#define EXT2F_COMPAT_SPARSESUPER2 0x0200
#define EXT2F_ROCOMPAT_SPARSESUPER 0x0001
#define EXT2F_ROCOMPAT_LARGEFILE 0x0002
@@ -214,6 +215,11 @@ struct csum {
#define EXT2F_ROCOMPAT_GDT_CSUM 0x0010
#define EXT2F_ROCOMPAT_DIR_NLINK 0x0020
#define EXT2F_ROCOMPAT_EXTRA_ISIZE 0x0040
+#define EXT2F_ROCOMPAT_QUOTA 0x0100
+#define EXT2F_ROCOMPAT_BIGALLOC 0x0200
+#define EXT2F_ROCOMPAT_METADATA_CKSUM 0x0400
+#define EXT2F_ROCOMPAT_READONLY 0x1000
+#define EXT2F_ROCOMPAT_PROJECT 0x2000
#define EXT2F_INCOMPAT_COMP 0x0001
#define EXT2F_INCOMPAT_FTYPE 0x0002
@@ -223,6 +229,12 @@ struct csum {
#define EXT2F_INCOMPAT_64BIT 0x0080
#define EXT2F_INCOMPAT_MMP 0x0100
#define EXT2F_INCOMPAT_FLEX_BG 0x0200
+#define EXT2F_INCOMPAT_EA_INODE 0x0400
+#define EXT2F_INCOMPAT_DIRDATA 0x1000
+#define EXT2F_INCOMPAT_CSUM_SEED 0x2000
+#define EXT2F_INCOMPAT_LARGEDIR 0x4000
+#define EXT2F_INCOMPAT_INLINE_DATA 0x8000
+#define EXT2F_INCOMPAT_ENCRYPT 0x10000
/*
* Features supported in this implementation
diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c
index 4f6e1b93b11a..65b8a54657be 100644
--- a/sys/fs/fdescfs/fdesc_vnops.c
+++ b/sys/fs/fdescfs/fdesc_vnops.c
@@ -394,7 +394,9 @@ fdesc_getattr(struct vop_getattr_args *ap)
{
struct vnode *vp = ap->a_vp;
struct vattr *vap = ap->a_vap;
+ struct timeval boottime;
+ getboottime(&boottime);
vap->va_mode = S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;
vap->va_fileid = VTOFDESC(vp)->fd_ix;
vap->va_uid = 0;
diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c
index 04be9672deb3..9ab5db614ded 100644
--- a/sys/fs/msdosfs/msdosfs_vnops.c
+++ b/sys/fs/msdosfs/msdosfs_vnops.c
@@ -1897,6 +1897,7 @@ struct vop_vector msdosfs_vnodeops = {
.vop_close = msdosfs_close,
.vop_create = msdosfs_create,
.vop_fsync = msdosfs_fsync,
+ .vop_fdatasync = vop_stdfdatasync_buf,
.vop_getattr = msdosfs_getattr,
.vop_inactive = msdosfs_inactive,
.vop_link = msdosfs_link,
diff --git a/sys/fs/nfs/nfs_commonkrpc.c b/sys/fs/nfs/nfs_commonkrpc.c
index 1a50ec8685fa..ad77f5edbf82 100644
--- a/sys/fs/nfs/nfs_commonkrpc.c
+++ b/sys/fs/nfs/nfs_commonkrpc.c
@@ -89,7 +89,7 @@ uint32_t nfscl_nfs4_done_probes[NFSV41_NPROCS + 1];
NFSSTATESPINLOCK;
NFSREQSPINLOCK;
NFSDLOCKMUTEX;
-extern struct nfsstats newnfsstats;
+extern struct nfsstatsv1 nfsstatsv1;
extern struct nfsreqhead nfsd_reqq;
extern int nfscl_ticks;
extern void (*ncl_call_invalcaches)(struct vnode *);
@@ -642,7 +642,7 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp,
procnum = NFSV4PROC_COMPOUND;
if (nmp != NULL) {
- NFSINCRGLOBAL(newnfsstats.rpcrequests);
+ NFSINCRGLOBAL(nfsstatsv1.rpcrequests);
/* Map the procnum to the old NFSv2 one, as required. */
if ((nd->nd_flag & ND_NFSV2) != 0) {
@@ -762,18 +762,18 @@ tryagain:
if (stat == RPC_SUCCESS) {
error = 0;
} else if (stat == RPC_TIMEDOUT) {
- NFSINCRGLOBAL(newnfsstats.rpctimeouts);
+ NFSINCRGLOBAL(nfsstatsv1.rpctimeouts);
error = ETIMEDOUT;
} else if (stat == RPC_VERSMISMATCH) {
- NFSINCRGLOBAL(newnfsstats.rpcinvalid);
+ NFSINCRGLOBAL(nfsstatsv1.rpcinvalid);
error = EOPNOTSUPP;
} else if (stat == RPC_PROGVERSMISMATCH) {
- NFSINCRGLOBAL(newnfsstats.rpcinvalid);
+ NFSINCRGLOBAL(nfsstatsv1.rpcinvalid);
error = EPROTONOSUPPORT;
} else if (stat == RPC_INTR) {
error = EINTR;
} else {
- NFSINCRGLOBAL(newnfsstats.rpcinvalid);
+ NFSINCRGLOBAL(nfsstatsv1.rpcinvalid);
error = EACCES;
}
if (error) {
diff --git a/sys/fs/nfs/nfs_commonport.c b/sys/fs/nfs/nfs_commonport.c
index a22073f87c20..23a861d4a9b1 100644
--- a/sys/fs/nfs/nfs_commonport.c
+++ b/sys/fs/nfs/nfs_commonport.c
@@ -58,7 +58,7 @@ extern void (*nfsd_call_recall)(struct vnode *, int, struct ucred *,
extern int nfsrv_useacl;
struct mount nfsv4root_mnt;
int newnfs_numnfsd = 0;
-struct nfsstats newnfsstats;
+struct nfsstatsv1 nfsstatsv1;
int nfs_numnfscbd = 0;
int nfscl_debuglevel = 0;
char nfsv4_callbackaddr[INET6_ADDRSTRLEN];
@@ -69,6 +69,7 @@ void (*ncl_call_invalcaches)(struct vnode *) = NULL;
static int nfs_realign_test;
static int nfs_realign_count;
+static struct ext_nfsstats oldnfsstats;
SYSCTL_NODE(_vfs, OID_AUTO, nfs, CTLFLAG_RW, 0, "NFS filesystem");
SYSCTL_INT(_vfs_nfs, OID_AUTO, realign_test, CTLFLAG_RW, &nfs_realign_test,
@@ -446,9 +447,12 @@ nfssvc_nfscommon(struct thread *td, struct nfssvc_args *uap)
static int
nfssvc_call(struct thread *p, struct nfssvc_args *uap, struct ucred *cred)
{
- int error = EINVAL;
+ int error = EINVAL, i, j;
struct nfsd_idargs nid;
struct nfsd_oidargs onid;
+ struct {
+ int vers; /* Just the first field of nfsstats. */
+ } nfsstatver;
if (uap->flag & NFSSVC_IDNAME) {
if ((uap->flag & NFSSVC_NEWSTRUCT) != 0)
@@ -472,63 +476,157 @@ nfssvc_call(struct thread *p, struct nfssvc_args *uap, struct ucred *cred)
error = nfssvc_idname(&nid);
goto out;
} else if (uap->flag & NFSSVC_GETSTATS) {
- error = copyout(&newnfsstats,
- CAST_USER_ADDR_T(uap->argp), sizeof (newnfsstats));
+ if ((uap->flag & NFSSVC_NEWSTRUCT) == 0) {
+ /* Copy fields to the old ext_nfsstat structure. */
+ oldnfsstats.attrcache_hits =
+ nfsstatsv1.attrcache_hits;
+ oldnfsstats.attrcache_misses =
+ nfsstatsv1.attrcache_misses;
+ oldnfsstats.lookupcache_hits =
+ nfsstatsv1.lookupcache_hits;
+ oldnfsstats.lookupcache_misses =
+ nfsstatsv1.lookupcache_misses;
+ oldnfsstats.direofcache_hits =
+ nfsstatsv1.direofcache_hits;
+ oldnfsstats.direofcache_misses =
+ nfsstatsv1.direofcache_misses;
+ oldnfsstats.accesscache_hits =
+ nfsstatsv1.accesscache_hits;
+ oldnfsstats.accesscache_misses =
+ nfsstatsv1.accesscache_misses;
+ oldnfsstats.biocache_reads =
+ nfsstatsv1.biocache_reads;
+ oldnfsstats.read_bios =
+ nfsstatsv1.read_bios;
+ oldnfsstats.read_physios =
+ nfsstatsv1.read_physios;
+ oldnfsstats.biocache_writes =
+ nfsstatsv1.biocache_writes;
+ oldnfsstats.write_bios =
+ nfsstatsv1.write_bios;
+ oldnfsstats.write_physios =
+ nfsstatsv1.write_physios;
+ oldnfsstats.biocache_readlinks =
+ nfsstatsv1.biocache_readlinks;
+ oldnfsstats.readlink_bios =
+ nfsstatsv1.readlink_bios;
+ oldnfsstats.biocache_readdirs =
+ nfsstatsv1.biocache_readdirs;
+ oldnfsstats.readdir_bios =
+ nfsstatsv1.readdir_bios;
+ for (i = 0; i < NFSV4_NPROCS; i++)
+ oldnfsstats.rpccnt[i] = nfsstatsv1.rpccnt[i];
+ oldnfsstats.rpcretries = nfsstatsv1.rpcretries;
+ for (i = 0; i < NFSV4OP_NOPS; i++)
+ oldnfsstats.srvrpccnt[i] =
+ nfsstatsv1.srvrpccnt[i];
+ for (i = NFSV42_NOPS, j = NFSV4OP_NOPS;
+ i < NFSV42_NOPS + NFSV4OP_FAKENOPS; i++, j++)
+ oldnfsstats.srvrpccnt[j] =
+ nfsstatsv1.srvrpccnt[i];
+ oldnfsstats.srvrpc_errs = nfsstatsv1.srvrpc_errs;
+ oldnfsstats.srv_errs = nfsstatsv1.srv_errs;
+ oldnfsstats.rpcrequests = nfsstatsv1.rpcrequests;
+ oldnfsstats.rpctimeouts = nfsstatsv1.rpctimeouts;
+ oldnfsstats.rpcunexpected = nfsstatsv1.rpcunexpected;
+ oldnfsstats.rpcinvalid = nfsstatsv1.rpcinvalid;
+ oldnfsstats.srvcache_inproghits =
+ nfsstatsv1.srvcache_inproghits;
+ oldnfsstats.srvcache_idemdonehits =
+ nfsstatsv1.srvcache_idemdonehits;
+ oldnfsstats.srvcache_nonidemdonehits =
+ nfsstatsv1.srvcache_nonidemdonehits;
+ oldnfsstats.srvcache_misses =
+ nfsstatsv1.srvcache_misses;
+ oldnfsstats.srvcache_tcppeak =
+ nfsstatsv1.srvcache_tcppeak;
+ oldnfsstats.srvcache_size = nfsstatsv1.srvcache_size;
+ oldnfsstats.srvclients = nfsstatsv1.srvclients;
+ oldnfsstats.srvopenowners = nfsstatsv1.srvopenowners;
+ oldnfsstats.srvopens = nfsstatsv1.srvopens;
+ oldnfsstats.srvlockowners = nfsstatsv1.srvlockowners;
+ oldnfsstats.srvlocks = nfsstatsv1.srvlocks;
+ oldnfsstats.srvdelegates = nfsstatsv1.srvdelegates;
+ for (i = 0; i < NFSV4OP_CBNOPS; i++)
+ oldnfsstats.cbrpccnt[i] =
+ nfsstatsv1.cbrpccnt[i];
+ oldnfsstats.clopenowners = nfsstatsv1.clopenowners;
+ oldnfsstats.clopens = nfsstatsv1.clopens;
+ oldnfsstats.cllockowners = nfsstatsv1.cllockowners;
+ oldnfsstats.cllocks = nfsstatsv1.cllocks;
+ oldnfsstats.cldelegates = nfsstatsv1.cldelegates;
+ oldnfsstats.cllocalopenowners =
+ nfsstatsv1.cllocalopenowners;
+ oldnfsstats.cllocalopens = nfsstatsv1.cllocalopens;
+ oldnfsstats.cllocallockowners =
+ nfsstatsv1.cllocallockowners;
+ oldnfsstats.cllocallocks = nfsstatsv1.cllocallocks;
+ error = copyout(&oldnfsstats, uap->argp,
+ sizeof (oldnfsstats));
+ } 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 ((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));
+ nfsstatsv1.attrcache_hits = 0;
+ nfsstatsv1.attrcache_misses = 0;
+ nfsstatsv1.lookupcache_hits = 0;
+ nfsstatsv1.lookupcache_misses = 0;
+ nfsstatsv1.direofcache_hits = 0;
+ nfsstatsv1.direofcache_misses = 0;
+ nfsstatsv1.accesscache_hits = 0;
+ nfsstatsv1.accesscache_misses = 0;
+ nfsstatsv1.biocache_reads = 0;
+ nfsstatsv1.read_bios = 0;
+ nfsstatsv1.read_physios = 0;
+ nfsstatsv1.biocache_writes = 0;
+ nfsstatsv1.write_bios = 0;
+ nfsstatsv1.write_physios = 0;
+ nfsstatsv1.biocache_readlinks = 0;
+ nfsstatsv1.readlink_bios = 0;
+ nfsstatsv1.biocache_readdirs = 0;
+ nfsstatsv1.readdir_bios = 0;
+ nfsstatsv1.rpcretries = 0;
+ nfsstatsv1.rpcrequests = 0;
+ nfsstatsv1.rpctimeouts = 0;
+ nfsstatsv1.rpcunexpected = 0;
+ nfsstatsv1.rpcinvalid = 0;
+ bzero(nfsstatsv1.rpccnt,
+ sizeof(nfsstatsv1.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.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));
+ nfsstatsv1.srvrpc_errs = 0;
+ nfsstatsv1.srv_errs = 0;
+ nfsstatsv1.srvcache_inproghits = 0;
+ nfsstatsv1.srvcache_idemdonehits = 0;
+ nfsstatsv1.srvcache_nonidemdonehits = 0;
+ nfsstatsv1.srvcache_misses = 0;
+ nfsstatsv1.srvcache_tcppeak = 0;
+ nfsstatsv1.srvclients = 0;
+ nfsstatsv1.srvopenowners = 0;
+ nfsstatsv1.srvopens = 0;
+ nfsstatsv1.srvlockowners = 0;
+ nfsstatsv1.srvlocks = 0;
+ nfsstatsv1.srvdelegates = 0;
+ nfsstatsv1.clopenowners = 0;
+ nfsstatsv1.clopens = 0;
+ nfsstatsv1.cllockowners = 0;
+ nfsstatsv1.cllocks = 0;
+ nfsstatsv1.cldelegates = 0;
+ nfsstatsv1.cllocalopenowners = 0;
+ nfsstatsv1.cllocalopens = 0;
+ nfsstatsv1.cllocallockowners = 0;
+ nfsstatsv1.cllocallocks = 0;
+ bzero(nfsstatsv1.srvrpccnt,
+ sizeof(nfsstatsv1.srvrpccnt));
+ bzero(nfsstatsv1.cbrpccnt,
+ sizeof(nfsstatsv1.cbrpccnt));
}
}
goto out;
diff --git a/sys/fs/nfs/nfsport.h b/sys/fs/nfs/nfsport.h
index 921df2d6fd1c..3bfbb1c01f68 100644
--- a/sys/fs/nfs/nfsport.h
+++ b/sys/fs/nfs/nfsport.h
@@ -55,6 +55,7 @@
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/mount.h>
+#include <sys/mutex.h>
#include <sys/namei.h>
#include <sys/proc.h>
#include <sys/protosw.h>
@@ -254,24 +255,26 @@
/*
* Must be one more than last op#.
+ * NFSv4.2 isn't implemented yet, but define the op# limit for it.
*/
#define NFSV41_NOPS 59
+#define NFSV42_NOPS 72
/* Quirky case if the illegal op code */
#define NFSV4OP_OPILLEGAL 10044
/*
- * Fake NFSV4OP_xxx used for nfsstat. Start at NFSV4OP_NOPS.
+ * Fake NFSV4OP_xxx used for nfsstat. Start at NFSV42_NOPS.
*/
-#define NFSV4OP_SYMLINK (NFSV4OP_NOPS)
-#define NFSV4OP_MKDIR (NFSV4OP_NOPS + 1)
-#define NFSV4OP_RMDIR (NFSV4OP_NOPS + 2)
-#define NFSV4OP_READDIRPLUS (NFSV4OP_NOPS + 3)
-#define NFSV4OP_MKNOD (NFSV4OP_NOPS + 4)
-#define NFSV4OP_FSSTAT (NFSV4OP_NOPS + 5)
-#define NFSV4OP_FSINFO (NFSV4OP_NOPS + 6)
-#define NFSV4OP_PATHCONF (NFSV4OP_NOPS + 7)
-#define NFSV4OP_V3CREATE (NFSV4OP_NOPS + 8)
+#define NFSV4OP_SYMLINK (NFSV42_NOPS)
+#define NFSV4OP_MKDIR (NFSV42_NOPS + 1)
+#define NFSV4OP_RMDIR (NFSV42_NOPS + 2)
+#define NFSV4OP_READDIRPLUS (NFSV42_NOPS + 3)
+#define NFSV4OP_MKNOD (NFSV42_NOPS + 4)
+#define NFSV4OP_FSSTAT (NFSV42_NOPS + 5)
+#define NFSV4OP_FSINFO (NFSV42_NOPS + 6)
+#define NFSV4OP_PATHCONF (NFSV42_NOPS + 7)
+#define NFSV4OP_V3CREATE (NFSV42_NOPS + 8)
/*
* This is the count of the fake operations listed above.
@@ -285,12 +288,12 @@
#define NFSV4OP_CBRECALL 4
/*
- * Must be one greater than the last Callback Operation#.
+ * Must be one greater than the last Callback Operation# for NFSv4.0.
*/
#define NFSV4OP_CBNOPS 5
/*
- * Additional Callback Ops for NFSv4.1 only. Not yet in nfsstats.
+ * Additional Callback Ops for NFSv4.1 only.
*/
#define NFSV4OP_CBLAYOUTRECALL 5
#define NFSV4OP_CBNOTIFY 6
@@ -303,6 +306,9 @@
#define NFSV4OP_CBNOTIFYLOCK 13
#define NFSV4OP_CBNOTIFYDEVID 14
+#define NFSV41_CBNOPS 15
+#define NFSV42_CBNOPS 16
+
/*
* The lower numbers -> 21 are used by NFSv2 and v3. These define higher
* numbers used by NFSv4.
@@ -360,7 +366,72 @@
#endif /* NFS_V3NPROCS */
/*
- * Stats structure
+ * New stats structure.
+ * The vers field will be set to NFSSTATS_V1 by the caller.
+ */
+#define NFSSTATS_V1 1
+struct nfsstatsv1 {
+ 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[NFSV41_NPROCS + 15];
+ uint64_t rpcretries;
+ uint64_t srvrpccnt[NFSV42_NOPS + NFSV4OP_FAKENOPS];
+ 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];
+ 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];
+ uint64_t srvops[NFSV42_NOPS + NFSV4OP_FAKENOPS];
+ struct bintime srvduration[NFSV42_NOPS + NFSV4OP_FAKENOPS];
+ struct bintime busyfrom;
+ struct bintime busytime;
+};
+
+/*
+ * Old stats structure.
*/
struct ext_nfsstats {
int attrcache_hits;
@@ -416,11 +487,6 @@ struct ext_nfsstats {
#ifdef _KERNEL
/*
- * Define the ext_nfsstats as nfsstats for the kernel code.
- */
-#define nfsstats ext_nfsstats
-
-/*
* Define NFS_NPROCS as NFSV4_NPROCS for the experimental kernel code.
*/
#ifndef NFS_NPROCS
@@ -872,7 +938,7 @@ int newnfs_realign(struct mbuf **, int);
/*
* Set boottime.
*/
-#define NFSSETBOOTTIME(b) ((b) = boottime)
+#define NFSSETBOOTTIME(b) (getboottime(&b))
/*
* The size of directory blocks in the buffer cache.
diff --git a/sys/fs/nfs/nfsproto.h b/sys/fs/nfs/nfsproto.h
index 08e7b24b5b1d..daa49a09eec1 100644
--- a/sys/fs/nfs/nfsproto.h
+++ b/sys/fs/nfs/nfsproto.h
@@ -345,10 +345,10 @@
/*
* NFSPROC_NOOP is a fake op# that can't be the same as any V2/3/4 Procedure
- * or Operation#. Since the NFS V4 Op #s go higher, use NFSV41_NOPS, which
+ * or Operation#. Since the NFS V4 Op #s go higher, use NFSV42_NOPS, which
* is one greater than the highest Op#.
*/
-#define NFSPROC_NOOP NFSV41_NOPS
+#define NFSPROC_NOOP NFSV42_NOPS
/* Actual Version 2 procedure numbers */
#define NFSV2PROC_NULL 0
diff --git a/sys/fs/nfsclient/nfs_clbio.c b/sys/fs/nfsclient/nfs_clbio.c
index 387584c365d8..492a072f4bdc 100644
--- a/sys/fs/nfsclient/nfs_clbio.c
+++ b/sys/fs/nfsclient/nfs_clbio.c
@@ -60,7 +60,7 @@ __FBSDID("$FreeBSD$");
#include <fs/nfsclient/nfs_kdtrace.h>
extern int newnfs_directio_allow_mmap;
-extern struct nfsstats newnfsstats;
+extern struct nfsstatsv1 nfsstatsv1;
extern struct mtx ncl_iod_mutex;
extern int ncl_numasync;
extern enum nfsiod_state ncl_iodwant[NFS_MAXASYNCDAEMON];
@@ -103,7 +103,7 @@ ncl_getpages(struct vop_getpages_args *ap)
npages = ap->a_count;
if ((object = vp->v_object) == NULL) {
- ncl_printf("nfs_getpages: called with non-merged cache vnode??\n");
+ printf("ncl_getpages: called with non-merged cache vnode\n");
return (VM_PAGER_ERROR);
}
@@ -111,7 +111,7 @@ ncl_getpages(struct vop_getpages_args *ap)
mtx_lock(&np->n_mtx);
if ((np->n_flag & NNONCACHE) && (vp->v_type == VREG)) {
mtx_unlock(&np->n_mtx);
- ncl_printf("nfs_getpages: called on non-cacheable vnode??\n");
+ printf("ncl_getpages: called on non-cacheable vnode\n");
return (VM_PAGER_ERROR);
} else
mtx_unlock(&np->n_mtx);
@@ -166,7 +166,7 @@ ncl_getpages(struct vop_getpages_args *ap)
relpbuf(bp, &ncl_pbuf_freecnt);
if (error && (uio.uio_resid == count)) {
- ncl_printf("nfs_getpages: error %d\n", error);
+ printf("ncl_getpages: error %d\n", error);
return (VM_PAGER_ERROR);
}
@@ -267,7 +267,7 @@ ncl_putpages(struct vop_putpages_args *ap)
if (newnfs_directio_enable && !newnfs_directio_allow_mmap &&
(np->n_flag & NNONCACHE) && (vp->v_type == VREG)) {
mtx_unlock(&np->n_mtx);
- ncl_printf("ncl_putpages: called on noncache-able vnode??\n");
+ printf("ncl_putpages: called on noncache-able vnode\n");
mtx_lock(&np->n_mtx);
}
@@ -466,7 +466,7 @@ ncl_bioread(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred)
switch (vp->v_type) {
case VREG:
- NFSINCRGLOBAL(newnfsstats.biocache_reads);
+ NFSINCRGLOBAL(nfsstatsv1.biocache_reads);
lbn = uio->uio_offset / biosize;
on = uio->uio_offset - (lbn * biosize);
@@ -543,7 +543,7 @@ ncl_bioread(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred)
n = MIN((unsigned)(bcount - on), uio->uio_resid);
break;
case VLNK:
- NFSINCRGLOBAL(newnfsstats.biocache_readlinks);
+ NFSINCRGLOBAL(nfsstatsv1.biocache_readlinks);
bp = nfs_getcacheblk(vp, (daddr_t)0, NFS_MAXPATHLEN, td);
if (!bp) {
error = newnfs_sigintr(nmp, td);
@@ -563,7 +563,7 @@ ncl_bioread(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred)
on = 0;
break;
case VDIR:
- NFSINCRGLOBAL(newnfsstats.biocache_readdirs);
+ NFSINCRGLOBAL(nfsstatsv1.biocache_readdirs);
if (np->n_direofoffset
&& uio->uio_offset >= np->n_direofoffset) {
return (0);
@@ -678,7 +678,7 @@ ncl_bioread(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred)
n = np->n_direofoffset - uio->uio_offset;
break;
default:
- ncl_printf(" ncl_bioread: type %x unexpected\n", vp->v_type);
+ printf(" ncl_bioread: type %x unexpected\n", vp->v_type);
bp = NULL;
break;
}
@@ -992,7 +992,7 @@ ncl_write(struct vop_write_args *ap)
}
}
- NFSINCRGLOBAL(newnfsstats.biocache_writes);
+ NFSINCRGLOBAL(nfsstatsv1.biocache_writes);
lbn = uio->uio_offset / biosize;
on = uio->uio_offset - (lbn * biosize);
n = MIN((unsigned)(biosize - on), uio->uio_resid);
@@ -1121,7 +1121,7 @@ again:
*/
if (bp->b_dirtyend > bcount) {
- ncl_printf("NFS append race @%lx:%d\n",
+ printf("NFS append race @%lx:%d\n",
(long)bp->b_blkno * DEV_BSIZE,
bp->b_dirtyend - bcount);
bp->b_dirtyend = bcount;
@@ -1606,7 +1606,7 @@ ncl_doio(struct vnode *vp, struct buf *bp, struct ucred *cr, struct thread *td,
switch (vp->v_type) {
case VREG:
uiop->uio_offset = ((off_t)bp->b_blkno) * DEV_BSIZE;
- NFSINCRGLOBAL(newnfsstats.read_bios);
+ NFSINCRGLOBAL(nfsstatsv1.read_bios);
error = ncl_readrpc(vp, uiop, cr);
if (!error) {
@@ -1641,11 +1641,11 @@ ncl_doio(struct vnode *vp, struct buf *bp, struct ucred *cr, struct thread *td,
break;
case VLNK:
uiop->uio_offset = (off_t)0;
- NFSINCRGLOBAL(newnfsstats.readlink_bios);
+ NFSINCRGLOBAL(nfsstatsv1.readlink_bios);
error = ncl_readlinkrpc(vp, uiop, cr);
break;
case VDIR:
- NFSINCRGLOBAL(newnfsstats.readdir_bios);
+ NFSINCRGLOBAL(nfsstatsv1.readdir_bios);
uiop->uio_offset = ((u_quad_t)bp->b_lblkno) * NFS_DIRBLKSIZ;
if ((nmp->nm_flag & NFSMNT_RDIRPLUS) != 0) {
error = ncl_readdirplusrpc(vp, uiop, cr, td);
@@ -1662,7 +1662,7 @@ ncl_doio(struct vnode *vp, struct buf *bp, struct ucred *cr, struct thread *td,
bp->b_flags |= B_INVAL;
break;
default:
- ncl_printf("ncl_doio: type %x unexpected\n", vp->v_type);
+ printf("ncl_doio: type %x unexpected\n", vp->v_type);
break;
}
if (error) {
@@ -1707,7 +1707,7 @@ ncl_doio(struct vnode *vp, struct buf *bp, struct ucred *cr, struct thread *td,
+ bp->b_dirtyoff;
io.iov_base = (char *)bp->b_data + bp->b_dirtyoff;
uiop->uio_rw = UIO_WRITE;
- NFSINCRGLOBAL(newnfsstats.write_bios);
+ NFSINCRGLOBAL(nfsstatsv1.write_bios);
if ((bp->b_flags & (B_ASYNC | B_NEEDCOMMIT | B_NOCACHE | B_CLUSTER)) == B_ASYNC)
iomode = NFSWRITE_UNSTABLE;
diff --git a/sys/fs/nfsclient/nfs_clcomsubs.c b/sys/fs/nfsclient/nfs_clcomsubs.c
index 1fc7d1b7ce41..e108b4bf9553 100644
--- a/sys/fs/nfsclient/nfs_clcomsubs.c
+++ b/sys/fs/nfsclient/nfs_clcomsubs.c
@@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$");
#ifndef APPLEKEXT
#include <fs/nfs/nfsport.h>
-extern struct nfsstats newnfsstats;
+extern struct nfsstatsv1 nfsstatsv1;
extern struct nfsv4_opflag nfsv4_opflag[NFSV41_NOPS];
extern int ncl_mbuf_mlen;
extern enum vtype newnv2tov_type[8];
@@ -241,8 +241,8 @@ nfscl_reqstart(struct nfsrv_descript *nd, int procnum, struct nfsmount *nmp,
} else {
(void) nfsm_fhtom(nd, nfhp, fhlen, 0);
}
- if (procnum < NFSV4_NPROCS)
- NFSINCRGLOBAL(newnfsstats.rpccnt[procnum]);
+ if (procnum < NFSV41_NPROCS)
+ NFSINCRGLOBAL(nfsstatsv1.rpccnt[procnum]);
}
#ifndef APPLE
diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c
index 20adaf1cddd7..e5b871f99579 100644
--- a/sys/fs/nfsclient/nfs_clstate.c
+++ b/sys/fs/nfsclient/nfs_clstate.c
@@ -84,7 +84,7 @@ __FBSDID("$FreeBSD$");
/*
* Global variables
*/
-extern struct nfsstats newnfsstats;
+extern struct nfsstatsv1 nfsstatsv1;
extern struct nfsreqhead nfsd_reqq;
extern u_int32_t newnfs_false, newnfs_true;
extern int nfscl_debuglevel;
@@ -343,10 +343,10 @@ nfscl_newopen(struct nfsclclient *clp, struct nfscldeleg *dp,
nowp->nfsow_defunct = 0;
nfscl_lockinit(&nowp->nfsow_rwlock);
if (dp != NULL) {
- newnfsstats.cllocalopenowners++;
+ nfsstatsv1.cllocalopenowners++;
LIST_INSERT_HEAD(&dp->nfsdl_owner, nowp, nfsow_list);
} else {
- newnfsstats.clopenowners++;
+ nfsstatsv1.clopenowners++;
LIST_INSERT_HEAD(&clp->nfsc_owner, nowp, nfsow_list);
}
owp = *owpp = nowp;
@@ -380,9 +380,9 @@ nfscl_newopen(struct nfsclclient *clp, struct nfscldeleg *dp,
TAILQ_INSERT_HEAD(&clp->nfsc_deleg, dp,
nfsdl_list);
dp->nfsdl_timestamp = NFSD_MONOSEC + 120;
- newnfsstats.cllocalopens++;
+ nfsstatsv1.cllocalopens++;
} else {
- newnfsstats.clopens++;
+ nfsstatsv1.clopens++;
}
LIST_INSERT_HEAD(&owp->nfsow_open, nop, nfso_list);
*opp = nop;
@@ -430,7 +430,7 @@ nfscl_deleg(mount_t mp, struct nfsclclient *clp, u_int8_t *nfhp,
LIST_INSERT_HEAD(NFSCLDELEGHASH(clp, nfhp, fhlen), dp,
nfsdl_hash);
dp->nfsdl_timestamp = NFSD_MONOSEC + 120;
- newnfsstats.cldelegates++;
+ nfsstatsv1.cldelegates++;
nfscl_delegcnt++;
} else {
/*
@@ -1071,10 +1071,10 @@ nfscl_getbytelock(vnode_t vp, u_int64_t off, u_int64_t len,
LIST_INIT(&nlp->nfsl_lock);
if (donelocally) {
nlp->nfsl_open = NULL;
- newnfsstats.cllocallockowners++;
+ nfsstatsv1.cllocallockowners++;
} else {
nlp->nfsl_open = op;
- newnfsstats.cllockowners++;
+ nfsstatsv1.cllockowners++;
}
LIST_INSERT_HEAD(lhp, nlp, nfsl_list);
lp = nlp;
@@ -1402,9 +1402,9 @@ nfscl_freeopen(struct nfsclopen *op, int local)
nfscl_freealllocks(&op->nfso_lock, local);
FREE((caddr_t)op, M_NFSCLOPEN);
if (local)
- newnfsstats.cllocalopens--;
+ nfsstatsv1.cllocalopens--;
else
- newnfsstats.clopens--;
+ nfsstatsv1.clopens--;
}
/*
@@ -1483,9 +1483,9 @@ nfscl_freeopenowner(struct nfsclowner *owp, int local)
LIST_REMOVE(owp, nfsow_list);
FREE((caddr_t)owp, M_NFSCLOWNER);
if (local)
- newnfsstats.cllocalopenowners--;
+ nfsstatsv1.cllocalopenowners--;
else
- newnfsstats.clopenowners--;
+ nfsstatsv1.clopenowners--;
}
/*
@@ -1502,9 +1502,9 @@ nfscl_freelockowner(struct nfscllockowner *lp, int local)
}
FREE((caddr_t)lp, M_NFSCLLOCKOWNER);
if (local)
- newnfsstats.cllocallockowners--;
+ nfsstatsv1.cllocallockowners--;
else
- newnfsstats.cllockowners--;
+ nfsstatsv1.cllockowners--;
}
/*
@@ -1517,9 +1517,9 @@ nfscl_freelock(struct nfscllock *lop, int local)
LIST_REMOVE(lop, nfslo_list);
FREE((caddr_t)lop, M_NFSCLLOCK);
if (local)
- newnfsstats.cllocallocks--;
+ nfsstatsv1.cllocallocks--;
else
- newnfsstats.cllocks--;
+ nfsstatsv1.cllocks--;
}
/*
@@ -1553,7 +1553,7 @@ nfscl_freedeleg(struct nfscldeleghead *hdp, struct nfscldeleg *dp)
TAILQ_REMOVE(hdp, dp, nfsdl_list);
LIST_REMOVE(dp, nfsdl_hash);
FREE((caddr_t)dp, M_NFSCLDELEG);
- newnfsstats.cldelegates--;
+ nfsstatsv1.cldelegates--;
nfscl_delegcnt--;
}
@@ -1621,18 +1621,18 @@ nfscl_expireclient(struct nfsclclient *clp, struct nfsmount *nmp,
LIST_REMOVE(op, nfso_list);
op->nfso_own = towp;
LIST_INSERT_HEAD(&towp->nfsow_open, op, nfso_list);
- newnfsstats.cllocalopens--;
- newnfsstats.clopens++;
+ nfsstatsv1.cllocalopens--;
+ nfsstatsv1.clopens++;
}
} else {
/* Just add the openowner to the client list */
LIST_REMOVE(owp, nfsow_list);
owp->nfsow_clp = clp;
LIST_INSERT_HEAD(&clp->nfsc_owner, owp, nfsow_list);
- newnfsstats.cllocalopenowners--;
- newnfsstats.clopenowners++;
- newnfsstats.cllocalopens--;
- newnfsstats.clopens++;
+ nfsstatsv1.cllocalopenowners--;
+ nfsstatsv1.clopenowners++;
+ nfsstatsv1.cllocalopens--;
+ nfsstatsv1.clopens++;
}
}
owp = nowp;
@@ -2282,9 +2282,9 @@ nfscl_insertlock(struct nfscllockowner *lp, struct nfscllock *new_lop,
else
LIST_INSERT_AFTER(insert_lop, new_lop, nfslo_list);
if (local)
- newnfsstats.cllocallocks++;
+ nfsstatsv1.cllocallocks++;
else
- newnfsstats.cllocks++;
+ nfsstatsv1.cllocks++;
}
/*
@@ -2571,7 +2571,7 @@ tryagain:
LIST_REMOVE(dp, nfsdl_hash);
TAILQ_INSERT_HEAD(&dh, dp, nfsdl_list);
nfscl_delegcnt--;
- newnfsstats.cldelegates--;
+ nfsstatsv1.cldelegates--;
}
NFSLOCKCLSTATE();
}
@@ -2612,7 +2612,7 @@ tryagain:
LIST_REMOVE(dp, nfsdl_hash);
TAILQ_INSERT_HEAD(&dh, dp, nfsdl_list);
nfscl_delegcnt--;
- newnfsstats.cldelegates--;
+ nfsstatsv1.cldelegates--;
}
}
dp = ndp;
@@ -3215,8 +3215,8 @@ nfscl_docb(struct nfsrv_descript *nd, NFSPROC_T *p)
break;
}
nd->nd_procnum = op;
- if (op < NFSV4OP_CBNOPS)
- newnfsstats.cbrpccnt[nd->nd_procnum]++;
+ if (op < NFSV41_CBNOPS)
+ nfsstatsv1.cbrpccnt[nd->nd_procnum]++;
switch (op) {
case NFSV4OP_CBGETATTR:
NFSCL_DEBUG(4, "cbgetattr\n");
diff --git a/sys/fs/nfsclient/nfs_clsubs.c b/sys/fs/nfsclient/nfs_clsubs.c
index cf21ef97a116..a8e94fc2872e 100644
--- a/sys/fs/nfsclient/nfs_clsubs.c
+++ b/sys/fs/nfsclient/nfs_clsubs.c
@@ -83,7 +83,7 @@ extern enum nfsiod_state ncl_iodwant[NFS_MAXASYNCDAEMON];
extern struct nfsmount *ncl_iodmount[NFS_MAXASYNCDAEMON];
extern int ncl_numasync;
extern unsigned int ncl_iodmax;
-extern struct nfsstats newnfsstats;
+extern struct nfsstatsv1 nfsstatsv1;
struct task ncl_nfsiodnew_task;
@@ -161,18 +161,6 @@ ncl_downgrade_vnlock(struct vnode *vp, int old_lock)
}
}
-void
-ncl_printf(const char *fmt, ...)
-{
- va_list ap;
-
- mtx_lock(&Giant);
- va_start(ap, fmt);
- vprintf(fmt, ap);
- va_end(ap);
- mtx_unlock(&Giant);
-}
-
#ifdef NFS_ACDEBUG
#include <sys/sysctl.h>
SYSCTL_DECL(_vfs_nfs);
@@ -197,16 +185,13 @@ ncl_getattrcache(struct vnode *vp, struct vattr *vaper)
vap = &np->n_vattr.na_vattr;
nmp = VFSTONFS(vp->v_mount);
mustflush = nfscl_mustflush(vp); /* must be before mtx_lock() */
-#ifdef NFS_ACDEBUG
- mtx_lock(&Giant); /* ncl_printf() */
-#endif
mtx_lock(&np->n_mtx);
/* XXX n_mtime doesn't seem to be updated on a miss-and-reload */
timeo = (time_second - np->n_mtime.tv_sec) / 10;
#ifdef NFS_ACDEBUG
if (nfs_acdebug>1)
- ncl_printf("nfs_getattrcache: initial timeo = %d\n", timeo);
+ printf("ncl_getattrcache: initial timeo = %d\n", timeo);
#endif
if (vap->va_type == VDIR) {
@@ -223,26 +208,23 @@ ncl_getattrcache(struct vnode *vp, struct vattr *vaper)
#ifdef NFS_ACDEBUG
if (nfs_acdebug > 2)
- ncl_printf("acregmin %d; acregmax %d; acdirmin %d; acdirmax %d\n",
- nmp->nm_acregmin, nmp->nm_acregmax,
- nmp->nm_acdirmin, nmp->nm_acdirmax);
+ printf("acregmin %d; acregmax %d; acdirmin %d; acdirmax %d\n",
+ nmp->nm_acregmin, nmp->nm_acregmax,
+ nmp->nm_acdirmin, nmp->nm_acdirmax);
if (nfs_acdebug)
- ncl_printf("nfs_getattrcache: age = %d; final timeo = %d\n",
- (time_second - np->n_attrstamp), timeo);
+ printf("ncl_getattrcache: age = %d; final timeo = %d\n",
+ (time_second - np->n_attrstamp), timeo);
#endif
if ((time_second - np->n_attrstamp) >= timeo &&
(mustflush != 0 || np->n_attrstamp == 0)) {
- newnfsstats.attrcache_misses++;
+ nfsstatsv1.attrcache_misses++;
mtx_unlock(&np->n_mtx);
-#ifdef NFS_ACDEBUG
- mtx_unlock(&Giant); /* ncl_printf() */
-#endif
KDTRACE_NFS_ATTRCACHE_GET_MISS(vp);
return( ENOENT);
}
- newnfsstats.attrcache_hits++;
+ nfsstatsv1.attrcache_hits++;
if (vap->va_size != np->n_size) {
if (vap->va_type == VREG) {
if (np->n_flag & NMODIFIED) {
@@ -266,9 +248,6 @@ ncl_getattrcache(struct vnode *vp, struct vattr *vaper)
vaper->va_mtime = np->n_mtim;
}
mtx_unlock(&np->n_mtx);
-#ifdef NFS_ACDEBUG
- mtx_unlock(&Giant); /* ncl_printf() */
-#endif
KDTRACE_NFS_ATTRCACHE_GET_HIT(vp, vap);
return (0);
}
diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c
index a3e2c7096d10..524a372d897a 100644
--- a/sys/fs/nfsclient/nfs_clvfsops.c
+++ b/sys/fs/nfsclient/nfs_clvfsops.c
@@ -78,7 +78,6 @@ FEATURE(nfscl, "NFSv4 client");
extern int nfscl_ticks;
extern struct timeval nfsboottime;
-extern struct nfsstats newnfsstats;
extern int nfsrv_useacl;
extern int nfscl_debuglevel;
extern enum nfsiod_state ncl_iodwant[NFS_MAXASYNCDAEMON];
diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c
index 5799d0bd6f30..69c1fe7848c5 100644
--- a/sys/fs/nfsclient/nfs_clvnops.c
+++ b/sys/fs/nfsclient/nfs_clvnops.c
@@ -100,7 +100,7 @@ uint32_t nfscl_accesscache_load_done_id;
#define TRUE 1
#define FALSE 0
-extern struct nfsstats newnfsstats;
+extern struct nfsstatsv1 nfsstatsv1;
extern int nfsrv_useacl;
extern int nfscl_debuglevel;
MALLOC_DECLARE(M_NEWNFSREQ);
@@ -258,14 +258,6 @@ int newnfs_directio_allow_mmap = 1;
SYSCTL_INT(_vfs_nfs, OID_AUTO, nfs_directio_allow_mmap, CTLFLAG_RW,
&newnfs_directio_allow_mmap, 0, "Enable mmaped IO on file with O_DIRECT opens");
-#if 0
-SYSCTL_INT(_vfs_nfs, OID_AUTO, access_cache_hits, CTLFLAG_RD,
- &newnfsstats.accesscache_hits, 0, "NFS ACCESS cache hit count");
-
-SYSCTL_INT(_vfs_nfs, OID_AUTO, access_cache_misses, CTLFLAG_RD,
- &newnfsstats.accesscache_misses, 0, "NFS ACCESS cache miss count");
-#endif
-
#define NFSACCESS_ALL (NFSACCESS_READ | NFSACCESS_MODIFY \
| NFSACCESS_EXTEND | NFSACCESS_EXECUTE \
| NFSACCESS_DELETE | NFSACCESS_LOOKUP)
@@ -418,7 +410,7 @@ nfs_access(struct vop_access_args *ap)
if (time_second < (np->n_accesscache[i].stamp
+ nfsaccess_cache_timeout) &&
(np->n_accesscache[i].mode & mode) == mode) {
- NFSINCRGLOBAL(newnfsstats.accesscache_hits);
+ NFSINCRGLOBAL(nfsstatsv1.accesscache_hits);
gotahit = 1;
}
break;
@@ -437,7 +429,7 @@ nfs_access(struct vop_access_args *ap)
/*
* Either a no, or a don't know. Go to the wire.
*/
- NFSINCRGLOBAL(newnfsstats.accesscache_misses);
+ NFSINCRGLOBAL(nfsstatsv1.accesscache_misses);
error = nfs34_access_otw(vp, wmode, ap->a_td,
ap->a_cred, &rmode);
if (!error &&
@@ -857,7 +849,7 @@ nfs_getattr(struct vop_getattr_args *ap)
if (NFS_ISV34(vp) && nfs_prime_access_cache &&
nfsaccess_cache_timeout > 0) {
- NFSINCRGLOBAL(newnfsstats.accesscache_misses);
+ NFSINCRGLOBAL(nfsstatsv1.accesscache_misses);
nfs34_access_otw(vp, NFSACCESS_ALL, td, ap->a_cred, NULL);
if (ncl_getattrcache(vp, ap->a_vap) == 0) {
nfscl_deleggetmodtime(vp, &ap->a_vap->va_mtime);
@@ -1114,7 +1106,7 @@ nfs_lookup(struct vop_lookup_args *ap)
((u_int)(ticks - ncticks) < (nmp->nm_nametimeo * hz) &&
VOP_GETATTR(newvp, &vattr, cnp->cn_cred) == 0 &&
timespeccmp(&vattr.va_ctime, &nctime, ==))) {
- NFSINCRGLOBAL(newnfsstats.lookupcache_hits);
+ NFSINCRGLOBAL(nfsstatsv1.lookupcache_hits);
if (cnp->cn_nameiop != LOOKUP &&
(flags & ISLASTCN))
cnp->cn_flags |= SAVENAME;
@@ -1141,7 +1133,7 @@ nfs_lookup(struct vop_lookup_args *ap)
if ((u_int)(ticks - ncticks) < (nmp->nm_negnametimeo * hz) &&
VOP_GETATTR(dvp, &vattr, cnp->cn_cred) == 0 &&
timespeccmp(&vattr.va_mtime, &nctime, ==)) {
- NFSINCRGLOBAL(newnfsstats.lookupcache_hits);
+ NFSINCRGLOBAL(nfsstatsv1.lookupcache_hits);
return (ENOENT);
}
cache_purge_negative(dvp);
@@ -1149,7 +1141,7 @@ nfs_lookup(struct vop_lookup_args *ap)
error = 0;
newvp = NULLVP;
- NFSINCRGLOBAL(newnfsstats.lookupcache_misses);
+ NFSINCRGLOBAL(nfsstatsv1.lookupcache_misses);
error = nfsrpc_lookup(dvp, cnp->cn_nameptr, cnp->cn_namelen,
cnp->cn_cred, td, &dnfsva, &nfsva, &nfhp, &attrflag, &dattrflag,
NULL);
@@ -1785,7 +1777,7 @@ nfs_rename(struct vop_rename_args *ap)
}
if (fvp == tvp) {
- ncl_printf("nfs_rename: fvp == tvp (can't happen)\n");
+ printf("nfs_rename: fvp == tvp (can't happen)\n");
error = 0;
goto out;
}
@@ -2227,7 +2219,7 @@ nfs_readdir(struct vop_readdir_args *ap)
if ((NFS_ISV4(vp) && np->n_change == vattr.va_filerev) ||
!NFS_TIMESPEC_COMPARE(&np->n_mtime, &vattr.va_mtime)) {
mtx_unlock(&np->n_mtx);
- NFSINCRGLOBAL(newnfsstats.direofcache_hits);
+ NFSINCRGLOBAL(nfsstatsv1.direofcache_hits);
if (ap->a_eofflag != NULL)
*ap->a_eofflag = 1;
return (0);
@@ -2254,7 +2246,7 @@ nfs_readdir(struct vop_readdir_args *ap)
error = ncl_bioread(vp, uio, 0, ap->a_cred);
if (!error && uio->uio_resid == tresid) {
- NFSINCRGLOBAL(newnfsstats.direofcache_misses);
+ NFSINCRGLOBAL(nfsstatsv1.direofcache_misses);
if (ap->a_eofflag != NULL)
*ap->a_eofflag = 1;
}
@@ -2313,7 +2305,7 @@ ncl_readdirrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred,
dnp->n_direofoffset = uiop->uio_offset;
else {
if (uiop->uio_resid > 0)
- ncl_printf("EEK! readdirrpc resid > 0\n");
+ printf("EEK! readdirrpc resid > 0\n");
ncl_dircookie_lock(dnp);
cookiep = ncl_getcookie(dnp, uiop->uio_offset, 1);
*cookiep = cookie;
@@ -2372,7 +2364,7 @@ ncl_readdirplusrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred,
dnp->n_direofoffset = uiop->uio_offset;
else {
if (uiop->uio_resid > 0)
- ncl_printf("EEK! readdirplusrpc resid > 0\n");
+ printf("EEK! readdirplusrpc resid > 0\n");
ncl_dircookie_lock(dnp);
cookiep = ncl_getcookie(dnp, uiop->uio_offset, 1);
*cookiep = cookie;
@@ -3145,8 +3137,8 @@ nfs_print(struct vop_print_args *ap)
struct vnode *vp = ap->a_vp;
struct nfsnode *np = VTONFS(vp);
- ncl_printf("\tfileid %ld fsid 0x%x",
- np->n_vattr.na_fileid, np->n_vattr.na_fsid);
+ printf("\tfileid %ld fsid 0x%x", np->n_vattr.na_fileid,
+ np->n_vattr.na_fsid);
if (vp->v_type == VFIFO)
fifo_printinfo(vp);
printf("\n");
diff --git a/sys/fs/nfsclient/nfsnode.h b/sys/fs/nfsclient/nfsnode.h
index d5cb7564f715..65f6c105b46d 100644
--- a/sys/fs/nfsclient/nfsnode.h
+++ b/sys/fs/nfsclient/nfsnode.h
@@ -185,7 +185,6 @@ nfsuint64 *ncl_getcookie(struct nfsnode *, off_t, int);
void ncl_invaldir(struct vnode *);
int ncl_upgrade_vnlock(struct vnode *);
void ncl_downgrade_vnlock(struct vnode *, int);
-void ncl_printf(const char *, ...);
void ncl_dircookie_lock(struct nfsnode *);
void ncl_dircookie_unlock(struct nfsnode *);
diff --git a/sys/fs/nfsserver/nfs_nfsdcache.c b/sys/fs/nfsserver/nfs_nfsdcache.c
index 0f78b3f06ec1..0b7bf8f3e1fb 100644
--- a/sys/fs/nfsserver/nfs_nfsdcache.c
+++ b/sys/fs/nfsserver/nfs_nfsdcache.c
@@ -159,7 +159,7 @@ __FBSDID("$FreeBSD$");
#ifndef APPLEKEXT
#include <fs/nfs/nfsport.h>
-extern struct nfsstats newnfsstats;
+extern struct nfsstatsv1 nfsstatsv1;
extern struct mtx nfsrc_udpmtx;
extern struct nfsrchash_bucket nfsrchash_table[NFSRVCACHE_HASHSIZE];
extern struct nfsrchash_bucket nfsrcahash_table[NFSRVCACHE_HASHSIZE];
@@ -318,8 +318,8 @@ nfsrvd_initcache(void)
TAILQ_INIT(&nfsrvudplru);
nfsrc_tcpsavedreplies = 0;
nfsrc_udpcachesize = 0;
- newnfsstats.srvcache_tcppeak = 0;
- newnfsstats.srvcache_size = 0;
+ nfsstatsv1.srvcache_tcppeak = 0;
+ nfsstatsv1.srvcache_size = 0;
}
/*
@@ -395,14 +395,14 @@ loop:
TAILQ_REMOVE(&nfsrvudplru, rp, rc_lru);
TAILQ_INSERT_TAIL(&nfsrvudplru, rp, rc_lru);
if (rp->rc_flag & RC_INPROG) {
- newnfsstats.srvcache_inproghits++;
+ nfsstatsv1.srvcache_inproghits++;
mtx_unlock(mutex);
ret = RC_DROPIT;
} else if (rp->rc_flag & RC_REPSTATUS) {
/*
* V2 only.
*/
- newnfsstats.srvcache_nonidemdonehits++;
+ nfsstatsv1.srvcache_nonidemdonehits++;
mtx_unlock(mutex);
nfsrvd_rephead(nd);
*(nd->nd_errp) = rp->rc_status;
@@ -410,7 +410,7 @@ loop:
rp->rc_timestamp = NFSD_MONOSEC +
NFSRVCACHE_UDPTIMEOUT;
} else if (rp->rc_flag & RC_REPMBUF) {
- newnfsstats.srvcache_nonidemdonehits++;
+ nfsstatsv1.srvcache_nonidemdonehits++;
mtx_unlock(mutex);
nd->nd_mreq = m_copym(rp->rc_reply, 0,
M_COPYALL, M_WAITOK);
@@ -425,8 +425,8 @@ loop:
goto out;
}
}
- newnfsstats.srvcache_misses++;
- atomic_add_int(&newnfsstats.srvcache_size, 1);
+ nfsstatsv1.srvcache_misses++;
+ atomic_add_int(&nfsstatsv1.srvcache_size, 1);
nfsrc_udpcachesize++;
newrp->rc_flag |= RC_INPROG;
@@ -480,7 +480,7 @@ nfsrvd_updatecache(struct nfsrv_descript *nd)
* Reply from cache is a special case returned by nfsrv_checkseqid().
*/
if (nd->nd_repstat == NFSERR_REPLYFROMCACHE) {
- newnfsstats.srvcache_nonidemdonehits++;
+ nfsstatsv1.srvcache_nonidemdonehits++;
mtx_unlock(mutex);
nd->nd_repstat = 0;
if (nd->nd_mreq)
@@ -519,8 +519,8 @@ nfsrvd_updatecache(struct nfsrv_descript *nd)
if (!(rp->rc_flag & RC_UDP)) {
atomic_add_int(&nfsrc_tcpsavedreplies, 1);
if (nfsrc_tcpsavedreplies >
- newnfsstats.srvcache_tcppeak)
- newnfsstats.srvcache_tcppeak =
+ nfsstatsv1.srvcache_tcppeak)
+ nfsstatsv1.srvcache_tcppeak =
nfsrc_tcpsavedreplies;
}
mtx_unlock(mutex);
@@ -678,7 +678,7 @@ tryagain:
panic("nfs tcp cache0");
rp->rc_flag |= RC_LOCKED;
if (rp->rc_flag & RC_INPROG) {
- newnfsstats.srvcache_inproghits++;
+ nfsstatsv1.srvcache_inproghits++;
mtx_unlock(mutex);
if (newrp->rc_sockref == rp->rc_sockref)
nfsrc_marksametcpconn(rp->rc_sockref);
@@ -687,7 +687,7 @@ tryagain:
/*
* V2 only.
*/
- newnfsstats.srvcache_nonidemdonehits++;
+ nfsstatsv1.srvcache_nonidemdonehits++;
mtx_unlock(mutex);
if (newrp->rc_sockref == rp->rc_sockref)
nfsrc_marksametcpconn(rp->rc_sockref);
@@ -696,7 +696,7 @@ tryagain:
*(nd->nd_errp) = rp->rc_status;
rp->rc_timestamp = NFSD_MONOSEC + nfsrc_tcptimeout;
} else if (rp->rc_flag & RC_REPMBUF) {
- newnfsstats.srvcache_nonidemdonehits++;
+ nfsstatsv1.srvcache_nonidemdonehits++;
mtx_unlock(mutex);
if (newrp->rc_sockref == rp->rc_sockref)
nfsrc_marksametcpconn(rp->rc_sockref);
@@ -711,8 +711,8 @@ tryagain:
free((caddr_t)newrp, M_NFSRVCACHE);
goto out;
}
- newnfsstats.srvcache_misses++;
- atomic_add_int(&newnfsstats.srvcache_size, 1);
+ nfsstatsv1.srvcache_misses++;
+ atomic_add_int(&nfsstatsv1.srvcache_size, 1);
/*
* For TCP, multiple entries for a key are allowed, so don't
@@ -801,7 +801,7 @@ nfsrc_freecache(struct nfsrvcache *rp)
atomic_add_int(&nfsrc_tcpsavedreplies, -1);
}
FREE((caddr_t)rp, M_NFSRVCACHE);
- atomic_add_int(&newnfsstats.srvcache_size, -1);
+ atomic_add_int(&nfsstatsv1.srvcache_size, -1);
}
/*
@@ -825,7 +825,7 @@ nfsrvd_cleancache(void)
nfsrc_freecache(rp);
}
}
- newnfsstats.srvcache_size = 0;
+ nfsstatsv1.srvcache_size = 0;
mtx_unlock(&nfsrc_udpmtx);
nfsrc_tcpsavedreplies = 0;
}
diff --git a/sys/fs/nfsserver/nfs_nfsdport.c b/sys/fs/nfsserver/nfs_nfsdport.c
index 2f6782994c33..52896a844708 100644
--- a/sys/fs/nfsserver/nfs_nfsdport.c
+++ b/sys/fs/nfsserver/nfs_nfsdport.c
@@ -62,6 +62,7 @@ extern struct nfsclienthashhead *nfsclienthash;
extern struct nfslockhashhead *nfslockhash;
extern struct nfssessionhash *nfssessionhash;
extern int nfsrv_sessionhashsize;
+extern struct nfsstatsv1 nfsstatsv1;
struct vfsoptlist nfsv4root_opt, nfsv4root_newopt;
NFSDLOCKMUTEX;
struct nfsrchash_bucket nfsrchash_table[NFSRVCACHE_HASHSIZE];
@@ -686,6 +687,8 @@ nfsvno_read(struct vnode *vp, off_t off, int cnt, struct ucred *cred,
uiop->uio_td = NULL;
nh = nfsrv_sequential_heuristic(uiop, vp);
ioflag |= nh->nh_seqcount << IO_SEQSHIFT;
+ /* XXX KDM make this more systematic? */
+ nfsstatsv1.srvbytes[NFSV4OP_READ] += uiop->uio_resid;
error = VOP_READ(vp, uiop, IO_NODELOCKED | ioflag, cred);
FREE((caddr_t)iv2, M_TEMP);
if (error) {
@@ -758,6 +761,8 @@ nfsvno_write(struct vnode *vp, off_t off, int retlen, int cnt, int stable,
uiop->uio_offset = off;
nh = nfsrv_sequential_heuristic(uiop, vp);
ioflags |= nh->nh_seqcount << IO_SEQSHIFT;
+ /* XXX KDM make this more systematic? */
+ nfsstatsv1.srvbytes[NFSV4OP_WRITE] += uiop->uio_resid;
error = VOP_WRITE(vp, uiop, ioflags, cred);
if (error == 0)
nh->nh_nextoff = uiop->uio_offset;
diff --git a/sys/fs/nfsserver/nfs_nfsdsocket.c b/sys/fs/nfsserver/nfs_nfsdsocket.c
index e09116cf2caa..f45bba4986d3 100644
--- a/sys/fs/nfsserver/nfs_nfsdsocket.c
+++ b/sys/fs/nfsserver/nfs_nfsdsocket.c
@@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$");
#ifndef APPLEKEXT
#include <fs/nfs/nfsport.h>
-extern struct nfsstats newnfsstats;
+extern struct nfsstatsv1 nfsstatsv1;
extern struct nfsrvfh nfs_pubfh, nfs_rootfh;
extern int nfs_pubfhset, nfs_rootfhset;
extern struct nfsv4lock nfsv4rootfs_lock;
@@ -400,6 +400,68 @@ static int nfsv3to4op[NFS_V3NPROCS] = {
NFSV4OP_COMMIT,
};
+static struct mtx nfsrvd_statmtx;
+MTX_SYSINIT(nfsst, &nfsrvd_statmtx, "NFSstat", MTX_DEF);
+
+static void
+nfsrvd_statstart(int op, struct bintime *now)
+{
+ if (op > (NFSV42_NOPS + NFSV4OP_FAKENOPS)) {
+ printf("%s: op %d invalid\n", __func__, op);
+ return;
+ }
+
+ mtx_lock(&nfsrvd_statmtx);
+ if (nfsstatsv1.srvstartcnt == nfsstatsv1.srvdonecnt) {
+ if (now != NULL)
+ nfsstatsv1.busyfrom = *now;
+ else
+ binuptime(&nfsstatsv1.busyfrom);
+
+ }
+ nfsstatsv1.srvrpccnt[op]++;
+ nfsstatsv1.srvstartcnt++;
+ mtx_unlock(&nfsrvd_statmtx);
+
+}
+
+static void
+nfsrvd_statend(int op, uint64_t bytes, struct bintime *now,
+ struct bintime *then)
+{
+ struct bintime dt, lnow;
+
+ if (op > (NFSV42_NOPS + NFSV4OP_FAKENOPS)) {
+ printf("%s: op %d invalid\n", __func__, op);
+ return;
+ }
+
+ if (now == NULL) {
+ now = &lnow;
+ binuptime(now);
+ }
+
+ mtx_lock(&nfsrvd_statmtx);
+
+ nfsstatsv1.srvbytes[op] += bytes;
+ nfsstatsv1.srvops[op]++;
+
+ if (then != NULL) {
+ dt = *now;
+ bintime_sub(&dt, then);
+ bintime_add(&nfsstatsv1.srvduration[op], &dt);
+ }
+
+ dt = *now;
+ bintime_sub(&dt, &nfsstatsv1.busyfrom);
+ bintime_add(&nfsstatsv1.busytime, &dt);
+ nfsstatsv1.busyfrom = *now;
+
+ nfsstatsv1.srvdonecnt++;
+
+ mtx_unlock(&nfsrvd_statmtx);
+}
+
/*
* Do an RPC. Basically, get the file handles translated to vnode pointers
* and then call the appropriate server routine. The server routines are
@@ -476,7 +538,9 @@ nfsrvd_dorpc(struct nfsrv_descript *nd, int isdgram, u_char *tag, int taglen,
*/
if (nd->nd_repstat && (nd->nd_flag & ND_NFSV2)) {
*nd->nd_errp = nfsd_errmap(nd);
- NFSINCRGLOBAL(newnfsstats.srvrpccnt[nfsv3to4op[nd->nd_procnum]]);
+ nfsrvd_statstart(nfsv3to4op[nd->nd_procnum], /*now*/ NULL);
+ nfsrvd_statend(nfsv3to4op[nd->nd_procnum], /*bytes*/ 0,
+ /*now*/ NULL, /*then*/ NULL);
if (mp != NULL && nfs_writerpc[nd->nd_procnum] != 0)
vn_finished_write(mp);
goto out;
@@ -491,6 +555,11 @@ nfsrvd_dorpc(struct nfsrv_descript *nd, int isdgram, u_char *tag, int taglen,
if (nd->nd_flag & ND_NFSV4) {
nfsrvd_compound(nd, isdgram, tag, taglen, minorvers, p);
} else {
+ struct bintime start_time;
+
+ binuptime(&start_time);
+ nfsrvd_statstart(nfsv3to4op[nd->nd_procnum], &start_time);
+
if (nfs_retfh[nd->nd_procnum] == 1) {
if (vp)
NFSVOPUNLOCK(vp, 0);
@@ -505,7 +574,9 @@ nfsrvd_dorpc(struct nfsrv_descript *nd, int isdgram, u_char *tag, int taglen,
}
if (mp != NULL && nfs_writerpc[nd->nd_procnum] != 0)
vn_finished_write(mp);
- NFSINCRGLOBAL(newnfsstats.srvrpccnt[nfsv3to4op[nd->nd_procnum]]);
+
+ nfsrvd_statend(nfsv3to4op[nd->nd_procnum], /*bytes*/ 0,
+ /*now*/ NULL, /*then*/ &start_time);
}
if (error) {
if (error != EBADRPC)
@@ -547,7 +618,7 @@ static void
nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, u_char *tag,
int taglen, u_int32_t minorvers, NFSPROC_T *p)
{
- int i, lktype, op, op0 = 0;
+ int i, lktype, op, op0 = 0, statsinprog = 0;
u_int32_t *tl;
struct nfsclient *clp, *nclp;
int numops, error = 0, igotlock;
@@ -559,6 +630,7 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, u_char *tag,
struct nfsexstuff nes, vpnes, savevpnes;
fsid_t cur_fsid, save_fsid;
static u_int64_t compref = 0;
+ struct bintime start_time;
NFSVNO_EXINIT(&vpnes);
NFSVNO_EXINIT(&savevpnes);
@@ -686,6 +758,11 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, u_char *tag,
*repp = *tl;
op = fxdr_unsigned(int, *tl);
NFSD_DEBUG(4, "op=%d\n", op);
+
+ binuptime(&start_time);
+ nfsrvd_statstart(op, &start_time);
+ statsinprog = 1;
+
if (op < NFSV4OP_ACCESS ||
(op >= NFSV4OP_NOPS && (nd->nd_flag & ND_NFSV41) == 0) ||
(op >= NFSV41_NOPS && (nd->nd_flag & ND_NFSV41) != 0)) {
@@ -771,12 +848,6 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, u_char *tag,
}
if (nfsv4_opflag[op].savereply)
nd->nd_flag |= ND_SAVEREPLY;
- /*
- * For now, newnfsstats.srvrpccnt[] doesn't have entries
- * for the NFSv4.1 operations.
- */
- if (nd->nd_procnum < NFSV4OP_NOPS)
- NFSINCRGLOBAL(newnfsstats.srvrpccnt[nd->nd_procnum]);
switch (op) {
case NFSV4OP_PUTFH:
error = nfsrv_mtofh(nd, &fh);
@@ -1007,6 +1078,13 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, u_char *tag,
}
error = 0;
}
+
+ if (statsinprog != 0) {
+ nfsrvd_statend(op, /*bytes*/ 0, /*now*/ NULL,
+ /*then*/ &start_time);
+ statsinprog = 0;
+ }
+
retops++;
if (nd->nd_repstat) {
*repp = nfsd_errmap(nd);
@@ -1016,6 +1094,11 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram, u_char *tag,
}
}
nfsmout:
+ if (statsinprog != 0) {
+ nfsrvd_statend(op, /*bytes*/ 0, /*now*/ NULL,
+ /*then*/ &start_time);
+ statsinprog = 0;
+ }
if (error) {
if (error == EBADRPC || error == NFSERR_BADXDR)
nd->nd_repstat = NFSERR_BADXDR;
diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c
index b0965017847d..1b90d021d6ca 100644
--- a/sys/fs/nfsserver/nfs_nfsdstate.c
+++ b/sys/fs/nfsserver/nfs_nfsdstate.c
@@ -37,7 +37,7 @@ int nfsrv_dolocallocks = 0;
struct nfsv4lock nfsv4rootfs_lock;
extern int newnfs_numnfsd;
-extern struct nfsstats newnfsstats;
+extern struct nfsstatsv1 nfsstatsv1;
extern int nfsrv_lease;
extern struct timeval nfsboottime;
extern u_int32_t newnfs_true, newnfs_false;
@@ -273,7 +273,7 @@ nfsrv_setclient(struct nfsrv_descript *nd, struct nfsclient **new_clpp,
LIST_INIT(&new_clp->lc_stateid[i]);
LIST_INSERT_HEAD(NFSCLIENTHASH(new_clp->lc_clientid), new_clp,
lc_hash);
- newnfsstats.srvclients++;
+ nfsstatsv1.srvclients++;
nfsrv_openpluslock++;
nfsrv_clients++;
NFSLOCKV4ROOTMUTEX();
@@ -377,7 +377,7 @@ nfsrv_setclient(struct nfsrv_descript *nd, struct nfsclient **new_clpp,
}
LIST_INSERT_HEAD(NFSCLIENTHASH(new_clp->lc_clientid), new_clp,
lc_hash);
- newnfsstats.srvclients++;
+ nfsstatsv1.srvclients++;
nfsrv_openpluslock++;
nfsrv_clients++;
NFSLOCKV4ROOTMUTEX();
@@ -441,7 +441,7 @@ nfsrv_setclient(struct nfsrv_descript *nd, struct nfsclient **new_clpp,
}
LIST_INSERT_HEAD(NFSCLIENTHASH(new_clp->lc_clientid), new_clp,
lc_hash);
- newnfsstats.srvclients++;
+ nfsstatsv1.srvclients++;
nfsrv_openpluslock++;
nfsrv_clients++;
}
@@ -815,7 +815,7 @@ out:
/*
* Dump out stats for all clients. Called from nfssvc(2), that is used
- * newnfsstats.
+ * nfsstatsv1.
*/
APPLESTATIC void
nfsrv_dumpclients(struct nfsd_dumpclients *dumpp, int maxcnt)
@@ -1219,7 +1219,7 @@ nfsrv_zapclient(struct nfsclient *clp, NFSPROC_T *p)
free(clp->lc_stateid, M_NFSDCLIENT);
free(clp, M_NFSDCLIENT);
NFSLOCKSTATE();
- newnfsstats.srvclients--;
+ nfsstatsv1.srvclients--;
nfsrv_openpluslock--;
nfsrv_clients--;
NFSUNLOCKSTATE();
@@ -1260,7 +1260,7 @@ nfsrv_freedeleg(struct nfsstate *stp)
nfsv4_testlock(&lfp->lf_locallock_lck) == 0)
nfsrv_freenfslockfile(lfp);
FREE((caddr_t)stp, M_NFSDSTATE);
- newnfsstats.srvdelegates--;
+ nfsstatsv1.srvdelegates--;
nfsrv_openpluslock--;
nfsrv_delegatecnt--;
}
@@ -1286,7 +1286,7 @@ nfsrv_freeopenowner(struct nfsstate *stp, int cansleep, NFSPROC_T *p)
if (stp->ls_op)
nfsrvd_derefcache(stp->ls_op);
FREE((caddr_t)stp, M_NFSDSTATE);
- newnfsstats.srvopenowners--;
+ nfsstatsv1.srvopenowners--;
nfsrv_openpluslock--;
}
@@ -1336,7 +1336,7 @@ nfsrv_freeopen(struct nfsstate *stp, vnode_t vp, int cansleep, NFSPROC_T *p)
if (cansleep != 0)
NFSUNLOCKSTATE();
FREE((caddr_t)stp, M_NFSDSTATE);
- newnfsstats.srvopens--;
+ nfsstatsv1.srvopens--;
nfsrv_openpluslock--;
return (ret);
}
@@ -1355,7 +1355,7 @@ nfsrv_freelockowner(struct nfsstate *stp, vnode_t vp, int cansleep,
if (stp->ls_op)
nfsrvd_derefcache(stp->ls_op);
FREE((caddr_t)stp, M_NFSDSTATE);
- newnfsstats.srvlockowners--;
+ nfsstatsv1.srvlockowners--;
nfsrv_openpluslock--;
}
@@ -1430,7 +1430,7 @@ nfsrv_freenfslock(struct nfslock *lop)
if (lop->lo_lckfile.le_prev != NULL) {
LIST_REMOVE(lop, lo_lckfile);
- newnfsstats.srvlocks--;
+ nfsstatsv1.srvlocks--;
nfsrv_openpluslock--;
}
LIST_REMOVE(lop, lo_lckowner);
@@ -2200,7 +2200,7 @@ tryagain:
LIST_INSERT_HEAD(&stp->ls_open, new_stp, ls_list);
*new_lopp = NULL;
*new_stpp = NULL;
- newnfsstats.srvlockowners++;
+ nfsstatsv1.srvlockowners++;
nfsrv_openpluslock++;
}
if (filestruct_locked != 0) {
@@ -2849,12 +2849,12 @@ tryagain:
LIST_INSERT_HEAD(&new_stp->ls_open, new_open, ls_list);
LIST_INSERT_HEAD(&clp->lc_open, new_stp, ls_list);
*new_stpp = NULL;
- newnfsstats.srvopenowners++;
+ nfsstatsv1.srvopenowners++;
nfsrv_openpluslock++;
}
openstp = new_open;
new_open = NULL;
- newnfsstats.srvopens++;
+ nfsstatsv1.srvopens++;
nfsrv_openpluslock++;
break;
}
@@ -2913,7 +2913,7 @@ tryagain:
NFSRV_V4DELEGLIMIT(nfsrv_delegatecnt) ||
!NFSVNO_DELEGOK(vp))
*rflagsp |= NFSV4OPEN_RECALL;
- newnfsstats.srvdelegates++;
+ nfsstatsv1.srvdelegates++;
nfsrv_openpluslock++;
nfsrv_delegatecnt++;
@@ -2953,12 +2953,12 @@ tryagain:
LIST_INSERT_HEAD(&new_stp->ls_open, new_open, ls_list);
LIST_INSERT_HEAD(&clp->lc_open, new_stp, ls_list);
*new_stpp = NULL;
- newnfsstats.srvopenowners++;
+ nfsstatsv1.srvopenowners++;
nfsrv_openpluslock++;
}
openstp = new_open;
new_open = NULL;
- newnfsstats.srvopens++;
+ nfsstatsv1.srvopens++;
nfsrv_openpluslock++;
} else {
error = NFSERR_RECLAIMCONFLICT;
@@ -3027,7 +3027,7 @@ tryagain:
new_deleg->ls_stateid), new_deleg, ls_hash);
LIST_INSERT_HEAD(&clp->lc_deleg, new_deleg, ls_list);
new_deleg = NULL;
- newnfsstats.srvdelegates++;
+ nfsstatsv1.srvdelegates++;
nfsrv_openpluslock++;
nfsrv_delegatecnt++;
}
@@ -3049,7 +3049,7 @@ tryagain:
new_open, ls_hash);
openstp = new_open;
new_open = NULL;
- newnfsstats.srvopens++;
+ nfsstatsv1.srvopens++;
nfsrv_openpluslock++;
/*
@@ -3094,7 +3094,7 @@ tryagain:
new_deleg->ls_stateid), new_deleg, ls_hash);
LIST_INSERT_HEAD(&clp->lc_deleg, new_deleg, ls_list);
new_deleg = NULL;
- newnfsstats.srvdelegates++;
+ nfsstatsv1.srvdelegates++;
nfsrv_openpluslock++;
nfsrv_delegatecnt++;
}
@@ -3173,7 +3173,7 @@ tryagain:
LIST_INSERT_HEAD(&clp->lc_deleg, new_deleg,
ls_list);
new_deleg = NULL;
- newnfsstats.srvdelegates++;
+ nfsstatsv1.srvdelegates++;
nfsrv_openpluslock++;
nfsrv_delegatecnt++;
}
@@ -3191,9 +3191,9 @@ tryagain:
openstp = new_open;
new_open = NULL;
*new_stpp = NULL;
- newnfsstats.srvopens++;
+ nfsstatsv1.srvopens++;
nfsrv_openpluslock++;
- newnfsstats.srvopenowners++;
+ nfsstatsv1.srvopenowners++;
nfsrv_openpluslock++;
}
if (!error) {
@@ -3645,7 +3645,7 @@ nfsrv_insertlock(struct nfslock *new_lop, struct nfslock *insert_lop,
else
LIST_INSERT_AFTER(insert_lop, new_lop, lo_lckowner);
if (stp != NULL) {
- newnfsstats.srvlocks++;
+ nfsstatsv1.srvlocks++;
nfsrv_openpluslock++;
}
}
@@ -3843,7 +3843,7 @@ out:
* just set lc_program to 0 to indicate no callbacks are possible.
* (For cases where the address can't be parsed or is 0.0.0.0.0.0, set
* the address to the client's transport address. This won't be used
- * for callbacks, but can be printed out by newnfsstats for info.)
+ * for callbacks, but can be printed out by nfsstats for info.)
* Return error if the xdr can't be parsed, 0 otherwise.
*/
APPLESTATIC int
diff --git a/sys/fs/procfs/procfs_status.c b/sys/fs/procfs/procfs_status.c
index 5a00ee157a54..defdec39ca72 100644
--- a/sys/fs/procfs/procfs_status.c
+++ b/sys/fs/procfs/procfs_status.c
@@ -70,6 +70,7 @@ procfs_doprocstatus(PFS_FILL_ARGS)
const char *wmesg;
char *pc;
char *sep;
+ struct timeval boottime;
int pid, ppid, pgid, sid;
int i;
@@ -129,6 +130,7 @@ procfs_doprocstatus(PFS_FILL_ARGS)
calcru(p, &ut, &st);
PROC_STATUNLOCK(p);
start = p->p_stats->p_start;
+ getboottime(&boottime);
timevaladd(&start, &boottime);
sbuf_printf(sb, " %jd,%ld %jd,%ld %jd,%ld",
(intmax_t)start.tv_sec, start.tv_usec,
diff --git a/sys/fs/pseudofs/pseudofs.c b/sys/fs/pseudofs/pseudofs.c
index 1824d0b005e2..b2ae67fd7767 100644
--- a/sys/fs/pseudofs/pseudofs.c
+++ b/sys/fs/pseudofs/pseudofs.c
@@ -383,11 +383,9 @@ pfs_init(struct pfs_info *pi, struct vfsconf *vfc)
struct pfs_node *root;
int error;
- mtx_assert(&Giant, MA_OWNED);
-
pfs_fileno_init(pi);
- /* set up the root diretory */
+ /* set up the root directory */
root = pfs_alloc_node(pi, "/", pfstype_root);
pi->pi_root = root;
pfs_fileno_alloc(root);
@@ -414,8 +412,6 @@ pfs_uninit(struct pfs_info *pi, struct vfsconf *vfc)
{
int error;
- mtx_assert(&Giant, MA_OWNED);
-
pfs_destroy(pi->pi_root);
pi->pi_root = NULL;
pfs_fileno_uninit(pi);
diff --git a/sys/fs/pseudofs/pseudofs.h b/sys/fs/pseudofs/pseudofs.h
index e2aeed6aef20..cc9b841cd042 100644
--- a/sys/fs/pseudofs/pseudofs.h
+++ b/sys/fs/pseudofs/pseudofs.h
@@ -189,16 +189,16 @@ typedef int (*pfs_destroy_t)(PFS_DESTROY_ARGS);
/*
* pfs_info: describes a pseudofs instance
*
- * The pi_mutex is only used to avoid using the global subr_unit lock for
- * unrhdr. The rest of struct pfs_info is only modified while Giant is
- * held (during vfs_init() and vfs_uninit()).
+ * The pi_mutex is only used to avoid using the global subr_unit lock
+ * for unrhdr. The rest of struct pfs_info is only modified during
+ * vfs_init() and vfs_uninit() of the consumer filesystem.
*/
struct pfs_info {
char pi_name[PFS_FSNAMELEN];
pfs_init_t pi_init;
pfs_init_t pi_uninit;
- /* members below this line are initialized at run time*/
+ /* members below this line are initialized at run time */
struct pfs_node *pi_root;
struct mtx pi_mutex;
struct unrhdr *pi_unrhdr;
@@ -285,17 +285,17 @@ static int \
_##name##_mount(struct mount *mp) { \
if (jflag && !prison_allow(curthread->td_ucred, jflag)) \
return (EPERM); \
- return pfs_mount(&name##_info, mp); \
+ return (pfs_mount(&name##_info, mp)); \
} \
\
static int \
_##name##_init(struct vfsconf *vfc) { \
- return pfs_init(&name##_info, vfc); \
+ return (pfs_init(&name##_info, vfc)); \
} \
\
static int \
_##name##_uninit(struct vfsconf *vfc) { \
- return pfs_uninit(&name##_info, vfc); \
+ return (pfs_uninit(&name##_info, vfc)); \
} \
\
static struct vfsops name##_vfsops = { \
diff --git a/sys/fs/pseudofs/pseudofs_fileno.c b/sys/fs/pseudofs/pseudofs_fileno.c
index a8c034f06dbc..f57731c29b27 100644
--- a/sys/fs/pseudofs/pseudofs_fileno.c
+++ b/sys/fs/pseudofs/pseudofs_fileno.c
@@ -52,7 +52,6 @@ void
pfs_fileno_init(struct pfs_info *pi)
{
- mtx_assert(&Giant, MA_OWNED);
mtx_init(&pi->pi_mutex, "pfs_fileno", NULL, MTX_DEF);
pi->pi_unrhdr = new_unrhdr(3, INT_MAX / NO_PID, &pi->pi_mutex);
}
@@ -64,7 +63,6 @@ void
pfs_fileno_uninit(struct pfs_info *pi)
{
- mtx_assert(&Giant, MA_OWNED);
delete_unrhdr(pi->pi_unrhdr);
pi->pi_unrhdr = NULL;
mtx_destroy(&pi->pi_mutex);
diff --git a/sys/fs/pseudofs/pseudofs_vncache.c b/sys/fs/pseudofs/pseudofs_vncache.c
index 1f9c04327bfb..1bec5a4c885c 100644
--- a/sys/fs/pseudofs/pseudofs_vncache.c
+++ b/sys/fs/pseudofs/pseudofs_vncache.c
@@ -84,7 +84,6 @@ void
pfs_vncache_load(void)
{
- mtx_assert(&Giant, MA_OWNED);
mtx_init(&pfs_vncache_mutex, "pfs_vncache", NULL, MTX_DEF);
pfs_exit_tag = EVENTHANDLER_REGISTER(process_exit, pfs_exit, NULL,
EVENTHANDLER_PRI_ANY);
@@ -97,7 +96,6 @@ void
pfs_vncache_unload(void)
{
- mtx_assert(&Giant, MA_OWNED);
EVENTHANDLER_DEREGISTER(process_exit, pfs_exit_tag);
KASSERT(pfs_vncache_entries == 0,
("%d vncache entries remaining", pfs_vncache_entries));
diff --git a/sys/fs/smbfs/smbfs_node.c b/sys/fs/smbfs/smbfs_node.c
index 05d19e98ef97..bf4223336f59 100644
--- a/sys/fs/smbfs/smbfs_node.c
+++ b/sys/fs/smbfs/smbfs_node.c
@@ -132,7 +132,7 @@ smbfs_node_alloc(struct mount *mp, struct vnode *dvp, const char *dirnm,
}
dnp = dvp ? VTOSMB(dvp) : NULL;
if (dnp == NULL && dvp != NULL) {
- vprint("smbfs_node_alloc: dead parent vnode", dvp);
+ vn_printf(dvp, "smbfs_node_alloc: dead parent vnode ");
return EINVAL;
}
error = vfs_hash_get(mp, smbfs_hash(name, nmlen), LK_EXCLUSIVE, td,
diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c
index 72e879205581..7ce4789c72ab 100644
--- a/sys/fs/tmpfs/tmpfs_subr.c
+++ b/sys/fs/tmpfs/tmpfs_subr.c
@@ -819,10 +819,13 @@ tmpfs_dir_lookup_cookie(struct tmpfs_node *node, off_t cookie,
goto out;
}
- MPASS((cookie & TMPFS_DIRCOOKIE_MASK) == cookie);
- dekey.td_hash = cookie;
- /* Recover if direntry for cookie was removed */
- de = RB_NFIND(tmpfs_dir, dirhead, &dekey);
+ if ((cookie & TMPFS_DIRCOOKIE_MASK) != cookie) {
+ de = NULL;
+ } else {
+ dekey.td_hash = cookie;
+ /* Recover if direntry for cookie was removed */
+ de = RB_NFIND(tmpfs_dir, dirhead, &dekey);
+ }
dc->tdc_tree = de;
dc->tdc_current = de;
if (de != NULL && tmpfs_dirent_duphead(de)) {
diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c
index 6b60dbd47fb5..16cc438a2205 100644
--- a/sys/fs/unionfs/union_vnops.c
+++ b/sys/fs/unionfs/union_vnops.c
@@ -1753,9 +1753,9 @@ unionfs_print(struct vop_print_args *ap)
*/
if (unp->un_uppervp != NULLVP)
- vprint("unionfs: upper", unp->un_uppervp);
+ vn_printf(unp->un_uppervp, "unionfs: upper ");
if (unp->un_lowervp != NULLVP)
- vprint("unionfs: lower", unp->un_lowervp);
+ vn_printf(unp->un_lowervp, "unionfs: lower ");
return (0);
}