usr/src/uts/common/sys/vnode.h
changeset 1488 196daa2cf3db
parent 789 b348f31ed315
child 1925 91047fd43318
--- a/usr/src/uts/common/sys/vnode.h	Sat Feb 25 00:24:50 2006 -0800
+++ b/usr/src/uts/common/sys/vnode.h	Sat Feb 25 01:33:06 2006 -0800
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -50,6 +49,9 @@
 #include <sys/uio.h>
 #include <sys/resource.h>
 #include <vm/seg_enum.h>
+#include <sys/kstat.h>
+#include <sys/kmem.h>
+#include <sys/avl.h>
 #ifdef	_KERNEL
 #include <sys/buf.h>
 #endif	/* _KERNEL */
@@ -94,6 +96,68 @@
 
 
 /*
+ * Statistics for all vnode operations.
+ * All operations record number of ops (since boot/mount/zero'ed).
+ * Certain I/O operations (read, write, readdir) also record number
+ * of bytes transferred.
+ * This appears in two places in the system: one is embedded in each
+ * vfs_t.  There is also an array of vopstats_t structures allocated
+ * on a per-fstype basis.
+ */
+
+#define	VOPSTATS_STR	"vopstats_"	/* Initial string for vopstat kstats */
+
+typedef struct vopstats {
+	kstat_named_t	nopen;		/* VOP_OPEN */
+	kstat_named_t	nclose;		/* VOP_CLOSE */
+	kstat_named_t	nread;		/* VOP_READ */
+	kstat_named_t	read_bytes;
+	kstat_named_t	nwrite;		/* VOP_WRITE */
+	kstat_named_t	write_bytes;
+	kstat_named_t	nioctl;		/* VOP_IOCTL */
+	kstat_named_t	nsetfl;		/* VOP_SETFL */
+	kstat_named_t	ngetattr;	/* VOP_GETATTR */
+	kstat_named_t	nsetattr;	/* VOP_SETATTR */
+	kstat_named_t	naccess;	/* VOP_ACCESS */
+	kstat_named_t	nlookup;	/* VOP_LOOKUP */
+	kstat_named_t	ncreate;	/* VOP_CREATE */
+	kstat_named_t	nremove;	/* VOP_REMOVE */
+	kstat_named_t	nlink;		/* VOP_LINK */
+	kstat_named_t	nrename;	/* VOP_RENAME */
+	kstat_named_t	nmkdir;		/* VOP_MKDIR */
+	kstat_named_t	nrmdir;		/* VOP_RMDIR */
+	kstat_named_t	nreaddir;	/* VOP_READDIR */
+	kstat_named_t	readdir_bytes;
+	kstat_named_t	nsymlink;	/* VOP_SYMLINK */
+	kstat_named_t	nreadlink;	/* VOP_READLINK */
+	kstat_named_t	nfsync;		/* VOP_FSYNC */
+	kstat_named_t	ninactive;	/* VOP_INACTIVE */
+	kstat_named_t	nfid;		/* VOP_FID */
+	kstat_named_t	nrwlock;	/* VOP_RWLOCK */
+	kstat_named_t	nrwunlock;	/* VOP_RWUNLOCK */
+	kstat_named_t	nseek;		/* VOP_SEEK */
+	kstat_named_t	ncmp;		/* VOP_CMP */
+	kstat_named_t	nfrlock;	/* VOP_FRLOCK */
+	kstat_named_t	nspace;		/* VOP_SPACE */
+	kstat_named_t	nrealvp;	/* VOP_REALVP */
+	kstat_named_t	ngetpage;	/* VOP_GETPAGE */
+	kstat_named_t	nputpage;	/* VOP_PUTPAGE */
+	kstat_named_t	nmap;		/* VOP_MAP */
+	kstat_named_t	naddmap;	/* VOP_ADDMAP */
+	kstat_named_t	ndelmap;	/* VOP_DELMAP */
+	kstat_named_t	npoll;		/* VOP_POLL */
+	kstat_named_t	ndump;		/* VOP_DUMP */
+	kstat_named_t	npathconf;	/* VOP_PATHCONF */
+	kstat_named_t	npageio;	/* VOP_PAGEIO */
+	kstat_named_t	ndumpctl;	/* VOP_DUMPCTL */
+	kstat_named_t	ndispose;	/* VOP_DISPOSE */
+	kstat_named_t	nsetsecattr;	/* VOP_SETSECATTR */
+	kstat_named_t	ngetsecattr;	/* VOP_GETSECATTR */
+	kstat_named_t	nshrlock;	/* VOP_SHRLOCK */
+	kstat_named_t	nvnevent;	/* VOP_VNEVENT */
+} vopstats_t;
+
+/*
  * The vnode is the focus of all file activity in UNIX.
  * A vnode is allocated for each active file, each current
  * directory, each mounted-on file, and the root.