Introduce cratom(), remove crcopy().
[dragonfly.git] / sys / vfs / coda / coda_opstats.h
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: src/sys/coda/coda_opstats.h,v 1.5 1999/08/28 00:40:54 peter Exp $
31  * $DragonFly: src/sys/vfs/coda/Attic/coda_opstats.h,v 1.2 2003/06/17 04:28:19 dillon Exp $
32  * 
33  */
34
35 /*
36  * operation stats: what the minicache can intercept that
37  * *isn't* seen by venus.  These stats are kept to augment
38  * the stats maintained by the Volume-Session mechanism.
39  */
40
41 /* vfsops:
42  *          mount: not currently bounced to Venus
43  *          umount: nope
44  *          root: only first call, rest is cached.
45  *          statfs: none (bogus)
46  *          sync: none (bogus)
47  *          vget: all
48  */
49
50 #define CODA_MOUNT_STATS  0
51 #define CODA_UMOUNT_STATS 1
52 #define CODA_ROOT_STATS   2
53 #define CODA_STATFS_STATS 3
54 #define CODA_SYNC_STATS   4
55 #define CODA_VGET_STATS   5
56 #define CODA_VFSOPS_SIZE  6
57
58 /* vnodeops:
59  *            open: all to venus
60  *            close: all to venus
61  *            rdrw: bogus.  Maybe redirected to UFS.
62  *                          May call open/close for internal opens/closes
63  *                          (Does exec not call open?)
64  *            ioctl: causes a lookupname
65  *                   passes through
66  *            select: can't get there from here.
67  *            getattr: can be satsified by cache
68  *            setattr: all go through
69  *            access: can be satisfied by cache
70  *            readlink: can be satisfied by cache
71  *            fsync: passes through
72  *            inactive: passes through
73  *            lookup: can be satisfied by cache
74  *            create: passes through
75  *            remove: passes through
76  *            link: passes through
77  *            rename: passes through
78  *            mkdir: passes through
79  *            rmdir: passes through
80  *            symlink: passes through
81  *            readdir: may be redirected to UFS
82  *                     may cause an "internal" open/close
83  */
84
85 #define CODA_OPEN_STATS     0
86 #define CODA_CLOSE_STATS    1
87 #define CODA_RDWR_STATS     2
88 #define CODA_IOCTL_STATS    3
89 #define CODA_SELECT_STATS   4
90 #define CODA_GETATTR_STATS  5
91 #define CODA_SETATTR_STATS  6
92 #define CODA_ACCESS_STATS   7
93 #define CODA_READLINK_STATS 8
94 #define CODA_FSYNC_STATS    9
95 #define CODA_INACTIVE_STATS 10
96 #define CODA_LOOKUP_STATS   11
97 #define CODA_CREATE_STATS   12
98 #define CODA_REMOVE_STATS   13
99 #define CODA_LINK_STATS     14
100 #define CODA_RENAME_STATS   15
101 #define CODA_MKDIR_STATS    16
102 #define CODA_RMDIR_STATS    17
103 #define CODA_SYMLINK_STATS  18
104 #define CODA_READDIR_STATS  19
105 #define CODA_VNODEOPS_SIZE  20
106
107 /*
108  * I propose the following structres:
109  */
110
111 struct coda_op_stats {
112     int opcode;       /* vfs opcode */
113     long entries;     /* number of times call attempted */
114     long sat_intrn;   /* number of times call satisfied by cache */
115     long unsat_intrn; /* number of times call failed in cache, but
116                          was not bounced to venus proper. */
117     long gen_intrn;   /* number of times call generated internally */
118                       /* (do we need that?) */
119 };
120
121 /*
122  * With each call to the minicache, we'll bump the counters whenver
123  * a call is satisfied internally (through the cache or through a
124  * redirect), and whenever an operation is caused internally.
125  * Then, we can add the total operations caught by the minicache
126  * to the world-wide totals, and leave a caveat for the specific
127  * graphs later.
128  */