This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / fs / xfs / linux / xfs_stats.h
1 /*
2  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of version 2 of the GNU General Public License as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it would be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11  *
12  * Further, this software is distributed without any warranty that it is
13  * free of the rightful claim of any third person regarding infringement
14  * or the like.  Any license provided herein, whether implied or
15  * otherwise, applies only to this software file.  Patent licenses, if
16  * any, provided herein do not apply to combinations of this program with
17  * other software, or any other product whatsoever.
18  *
19  * You should have received a copy of the GNU General Public License along
20  * with this program; if not, write the Free Software Foundation, Inc., 59
21  * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22  *
23  * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24  * Mountain View, CA  94043, or:
25  *
26  * http://www.sgi.com
27  *
28  * For further information regarding this notice, see:
29  *
30  * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31  */
32 #ifndef __XFS_STATS_H__
33 #define __XFS_STATS_H__
34
35
36 #if defined(CONFIG_PROC_FS) && !defined(XFS_STATS_OFF)
37
38 #include <linux/percpu.h>
39
40 /*
41  * XFS global statistics
42  */
43 struct xfsstats {
44 # define XFSSTAT_END_EXTENT_ALLOC       4
45         __uint32_t              xs_allocx;
46         __uint32_t              xs_allocb;
47         __uint32_t              xs_freex;
48         __uint32_t              xs_freeb;
49 # define XFSSTAT_END_ALLOC_BTREE        (XFSSTAT_END_EXTENT_ALLOC+4)
50         __uint32_t              xs_abt_lookup;
51         __uint32_t              xs_abt_compare;
52         __uint32_t              xs_abt_insrec;
53         __uint32_t              xs_abt_delrec;
54 # define XFSSTAT_END_BLOCK_MAPPING      (XFSSTAT_END_ALLOC_BTREE+7)
55         __uint32_t              xs_blk_mapr;
56         __uint32_t              xs_blk_mapw;
57         __uint32_t              xs_blk_unmap;
58         __uint32_t              xs_add_exlist;
59         __uint32_t              xs_del_exlist;
60         __uint32_t              xs_look_exlist;
61         __uint32_t              xs_cmp_exlist;
62 # define XFSSTAT_END_BLOCK_MAP_BTREE    (XFSSTAT_END_BLOCK_MAPPING+4)
63         __uint32_t              xs_bmbt_lookup;
64         __uint32_t              xs_bmbt_compare;
65         __uint32_t              xs_bmbt_insrec;
66         __uint32_t              xs_bmbt_delrec;
67 # define XFSSTAT_END_DIRECTORY_OPS      (XFSSTAT_END_BLOCK_MAP_BTREE+4)
68         __uint32_t              xs_dir_lookup;
69         __uint32_t              xs_dir_create;
70         __uint32_t              xs_dir_remove;
71         __uint32_t              xs_dir_getdents;
72 # define XFSSTAT_END_TRANSACTIONS       (XFSSTAT_END_DIRECTORY_OPS+3)
73         __uint32_t              xs_trans_sync;
74         __uint32_t              xs_trans_async;
75         __uint32_t              xs_trans_empty;
76 # define XFSSTAT_END_INODE_OPS          (XFSSTAT_END_TRANSACTIONS+7)
77         __uint32_t              xs_ig_attempts;
78         __uint32_t              xs_ig_found;
79         __uint32_t              xs_ig_frecycle;
80         __uint32_t              xs_ig_missed;
81         __uint32_t              xs_ig_dup;
82         __uint32_t              xs_ig_reclaims;
83         __uint32_t              xs_ig_attrchg;
84 # define XFSSTAT_END_LOG_OPS            (XFSSTAT_END_INODE_OPS+5)
85         __uint32_t              xs_log_writes;
86         __uint32_t              xs_log_blocks;
87         __uint32_t              xs_log_noiclogs;
88         __uint32_t              xs_log_force;
89         __uint32_t              xs_log_force_sleep;
90 # define XFSSTAT_END_TAIL_PUSHING       (XFSSTAT_END_LOG_OPS+10)
91         __uint32_t              xs_try_logspace;
92         __uint32_t              xs_sleep_logspace;
93         __uint32_t              xs_push_ail;
94         __uint32_t              xs_push_ail_success;
95         __uint32_t              xs_push_ail_pushbuf;
96         __uint32_t              xs_push_ail_pinned;
97         __uint32_t              xs_push_ail_locked;
98         __uint32_t              xs_push_ail_flushing;
99         __uint32_t              xs_push_ail_restarts;
100         __uint32_t              xs_push_ail_flush;
101 # define XFSSTAT_END_WRITE_CONVERT      (XFSSTAT_END_TAIL_PUSHING+2)
102         __uint32_t              xs_xstrat_quick;
103         __uint32_t              xs_xstrat_split;
104 # define XFSSTAT_END_READ_WRITE_OPS     (XFSSTAT_END_WRITE_CONVERT+2)
105         __uint32_t              xs_write_calls;
106         __uint32_t              xs_read_calls;
107 # define XFSSTAT_END_ATTRIBUTE_OPS      (XFSSTAT_END_READ_WRITE_OPS+4)
108         __uint32_t              xs_attr_get;
109         __uint32_t              xs_attr_set;
110         __uint32_t              xs_attr_remove;
111         __uint32_t              xs_attr_list;
112 # define XFSSTAT_END_INODE_CLUSTER      (XFSSTAT_END_ATTRIBUTE_OPS+3)
113         __uint32_t              xs_iflush_count;
114         __uint32_t              xs_icluster_flushcnt;
115         __uint32_t              xs_icluster_flushinode;
116 # define XFSSTAT_END_VNODE_OPS          (XFSSTAT_END_INODE_CLUSTER+8)
117         __uint32_t              vn_active;      /* # vnodes not on free lists */
118         __uint32_t              vn_alloc;       /* # times vn_alloc called */
119         __uint32_t              vn_get;         /* # times vn_get called */
120         __uint32_t              vn_hold;        /* # times vn_hold called */
121         __uint32_t              vn_rele;        /* # times vn_rele called */
122         __uint32_t              vn_reclaim;     /* # times vn_reclaim called */
123         __uint32_t              vn_remove;      /* # times vn_remove called */
124         __uint32_t              vn_free;        /* # times vn_free called */
125 #define XFSSTAT_END_BUF                 (XFSSTAT_END_VNODE_OPS+9)
126         __uint32_t              pb_get;
127         __uint32_t              pb_create;
128         __uint32_t              pb_get_locked;
129         __uint32_t              pb_get_locked_waited;
130         __uint32_t              pb_busy_locked;
131         __uint32_t              pb_miss_locked;
132         __uint32_t              pb_page_retries;
133         __uint32_t              pb_page_found;
134         __uint32_t              pb_get_read;
135 /* Extra precision counters */
136         __uint64_t              xs_xstrat_bytes;
137         __uint64_t              xs_write_bytes;
138         __uint64_t              xs_read_bytes;
139 };
140
141 DECLARE_PER_CPU(struct xfsstats, xfsstats);
142
143 /* We don't disable preempt, not too worried about poking the
144  * wrong cpu's stat for now */
145 #define XFS_STATS_INC(count)            (__get_cpu_var(xfsstats).count++)
146 #define XFS_STATS_DEC(count)            (__get_cpu_var(xfsstats).count--)
147 #define XFS_STATS_ADD(count, inc)       (__get_cpu_var(xfsstats).count += (inc))
148
149 extern void xfs_init_procfs(void);
150 extern void xfs_cleanup_procfs(void);
151
152
153 #else   /* !CONFIG_PROC_FS */
154
155 # define XFS_STATS_INC(count)
156 # define XFS_STATS_DEC(count)
157 # define XFS_STATS_ADD(count, inc)
158
159 static __inline void xfs_init_procfs(void) { };
160 static __inline void xfs_cleanup_procfs(void) { };
161
162 #endif  /* !CONFIG_PROC_FS */
163
164 #endif /* __XFS_STATS_H__ */