1/*-
2 *
3 *             Coda: an Experimental Distributed File System
4 *                              Release 3.1
5 *
6 *           Copyright (c) 1987-1998 Carnegie Mellon University
7 *                          All Rights Reserved
8 *
9 * Permission  to  use, copy, modify and distribute this software and its
10 * documentation is hereby granted,  provided  that  both  the  copyright
11 * notice  and  this  permission  notice  appear  in  all  copies  of the
12 * software, derivative works or  modified  versions,  and  any  portions
13 * thereof, and that both notices appear in supporting documentation, and
14 * that credit is given to Carnegie Mellon University  in  all  documents
15 * and publicity pertaining to direct or indirect use of this code or its
16 * derivatives.
17 *
18 * CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS  KNOWN  TO  HAVE  BUGS,
19 * SOME  OF  WHICH MAY HAVE SERIOUS CONSEQUENCES.  CARNEGIE MELLON ALLOWS
20 * FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.   CARNEGIE  MELLON
21 * DISCLAIMS  ANY  LIABILITY  OF  ANY  KIND  FOR  ANY  DAMAGES WHATSOEVER
22 * RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE  OR  OF
23 * ANY DERIVATIVE WORK.
24 *
25 * Carnegie  Mellon  encourages  users  of  this  software  to return any
26 * improvements or extensions that  they  make,  and  to  grant  Carnegie
27 * Mellon the rights to redistribute these changes without encumbrance.
28 *
29 * 	@(#) src/sys/coda/coda_opstats.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
30 * $FreeBSD$
31 *
32 */
33
34#ifndef _CODA_OPSTATS_H_
35#define	_CODA_OPSTATS_H_
36
37/*
38 * Operation stats: what the minicache can intercept that *isn't* seen by
39 * venus.  These stats are kept to augment the stats maintained by the
40 * Volume-Session mechanism.
41 */
42
43/*-
44 * vfsops:
45 *          mount: not currently bounced to Venus
46 *          umount: nope
47 *          root: only first call, rest is cached.
48 *          statfs: none (bogus)
49 *          sync: none (bogus)
50 *          vget: all
51 */
52#define	CODA_MOUNT_STATS	0
53#define	CODA_UMOUNT_STATS	1
54#define	CODA_ROOT_STATS		2
55#define	CODA_STATFS_STATS	3
56#define	CODA_SYNC_STATS		4
57#define	CODA_VGET_STATS		5
58#define	CODA_VFSOPS_SIZE	6
59
60/*-
61 * vnodeops:
62 *            open: all to venus
63 *            close: all to venus
64 *            rdrw: bogus.  Maybe redirected to UFS.
65 *                          May call open/close for internal opens/closes
66 *                          (Does exec not call open?)
67 *            ioctl: causes a lookupname
68 *                   passes through
69 *            select: can't get there from here.
70 *            getattr: can be satsified by cache
71 *            setattr: all go through
72 *            access: can be satisfied by cache
73 *            readlink: can be satisfied by cache
74 *            fsync: passes through
75 *            inactive: passes through
76 *            lookup: can be satisfied by cache
77 *            create: passes through
78 *            remove: passes through
79 *            link: passes through
80 *            rename: passes through
81 *            mkdir: passes through
82 *            rmdir: passes through
83 *            symlink: passes through
84 *            readdir: may be redirected to UFS
85 *                     may cause an "internal" open/close
86 */
87#define	CODA_OPEN_STATS		0
88#define	CODA_CLOSE_STATS	1
89#define	CODA_RDWR_STATS		2
90#define	CODA_IOCTL_STATS	3
91#define	CODA_SELECT_STATS	4
92#define	CODA_GETATTR_STATS	5
93#define	CODA_SETATTR_STATS	6
94#define	CODA_ACCESS_STATS	7
95#define	CODA_READLINK_STATS	8
96#define	CODA_FSYNC_STATS	9
97#define	CODA_INACTIVE_STATS	10
98#define	CODA_LOOKUP_STATS	11
99#define	CODA_CREATE_STATS	12
100#define	CODA_REMOVE_STATS	13
101#define	CODA_LINK_STATS		14
102#define	CODA_RENAME_STATS	15
103#define	CODA_MKDIR_STATS	16
104#define	CODA_RMDIR_STATS	17
105#define	CODA_SYMLINK_STATS	18
106#define	CODA_READDIR_STATS	19
107#define	CODA_VNODEOPS_SIZE	20
108
109/*
110 * I propose the following structres:
111 */
112struct coda_op_stats {
113	int	opcode;		/* vfs opcode */
114	long	entries;	/* number of times call attempted */
115	long	sat_intrn;	/* number of times call satisfied by cache */
116	long	unsat_intrn;	/* number of times call failed in cache, but */
117				/*  was not bounced to venus proper. */
118	long	gen_intrn;	/* number of times call generated internally */
119				/* (do we need that?) */
120};
121
122/*
123 * With each call to the minicache, we'll bump the counters whenver a call is
124 * satisfied internally (through the cache or through a redirect), and
125 * whenever an operation is caused internally.  Then, we can add the total
126 * operations caught by the minicache to the world-wide totals, and leave a
127 * caveat for the specific graphs later.
128 */
129
130#endif /* !_CODA_OPSTATS_H_ */
131