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 /*
39  * XFS global statistics
40  */
41 struct xfsstats {
42 # define XFSSTAT_END_EXTENT_ALLOC	4
43 	__uint32_t		xs_allocx;
44 	__uint32_t		xs_allocb;
45 	__uint32_t		xs_freex;
46 	__uint32_t		xs_freeb;
47 # define XFSSTAT_END_ALLOC_BTREE	(XFSSTAT_END_EXTENT_ALLOC+4)
48 	__uint32_t		xs_abt_lookup;
49 	__uint32_t		xs_abt_compare;
50 	__uint32_t		xs_abt_insrec;
51 	__uint32_t		xs_abt_delrec;
52 # define XFSSTAT_END_BLOCK_MAPPING	(XFSSTAT_END_ALLOC_BTREE+7)
53 	__uint32_t		xs_blk_mapr;
54 	__uint32_t		xs_blk_mapw;
55 	__uint32_t		xs_blk_unmap;
56 	__uint32_t		xs_add_exlist;
57 	__uint32_t		xs_del_exlist;
58 	__uint32_t		xs_look_exlist;
59 	__uint32_t		xs_cmp_exlist;
60 # define XFSSTAT_END_BLOCK_MAP_BTREE	(XFSSTAT_END_BLOCK_MAPPING+4)
61 	__uint32_t		xs_bmbt_lookup;
62 	__uint32_t		xs_bmbt_compare;
63 	__uint32_t		xs_bmbt_insrec;
64 	__uint32_t		xs_bmbt_delrec;
65 # define XFSSTAT_END_DIRECTORY_OPS	(XFSSTAT_END_BLOCK_MAP_BTREE+4)
66 	__uint32_t		xs_dir_lookup;
67 	__uint32_t		xs_dir_create;
68 	__uint32_t		xs_dir_remove;
69 	__uint32_t		xs_dir_getdents;
70 # define XFSSTAT_END_TRANSACTIONS	(XFSSTAT_END_DIRECTORY_OPS+3)
71 	__uint32_t		xs_trans_sync;
72 	__uint32_t		xs_trans_async;
73 	__uint32_t		xs_trans_empty;
74 # define XFSSTAT_END_INODE_OPS		(XFSSTAT_END_TRANSACTIONS+7)
75 	__uint32_t		xs_ig_attempts;
76 	__uint32_t		xs_ig_found;
77 	__uint32_t		xs_ig_frecycle;
78 	__uint32_t		xs_ig_missed;
79 	__uint32_t		xs_ig_dup;
80 	__uint32_t		xs_ig_reclaims;
81 	__uint32_t		xs_ig_attrchg;
82 # define XFSSTAT_END_LOG_OPS		(XFSSTAT_END_INODE_OPS+5)
83 	__uint32_t		xs_log_writes;
84 	__uint32_t		xs_log_blocks;
85 	__uint32_t		xs_log_noiclogs;
86 	__uint32_t		xs_log_force;
87 	__uint32_t		xs_log_force_sleep;
88 # define XFSSTAT_END_TAIL_PUSHING	(XFSSTAT_END_LOG_OPS+10)
89 	__uint32_t		xs_try_logspace;
90 	__uint32_t		xs_sleep_logspace;
91 	__uint32_t		xs_push_ail;
92 	__uint32_t		xs_push_ail_success;
93 	__uint32_t		xs_push_ail_pushbuf;
94 	__uint32_t		xs_push_ail_pinned;
95 	__uint32_t		xs_push_ail_locked;
96 	__uint32_t		xs_push_ail_flushing;
97 	__uint32_t		xs_push_ail_restarts;
98 	__uint32_t		xs_push_ail_flush;
99 # define XFSSTAT_END_WRITE_CONVERT	(XFSSTAT_END_TAIL_PUSHING+2)
100 	__uint32_t		xs_xstrat_quick;
101 	__uint32_t		xs_xstrat_split;
102 # define XFSSTAT_END_READ_WRITE_OPS	(XFSSTAT_END_WRITE_CONVERT+2)
103 	__uint32_t		xs_write_calls;
104 	__uint32_t		xs_read_calls;
105 # define XFSSTAT_END_ATTRIBUTE_OPS	(XFSSTAT_END_READ_WRITE_OPS+4)
106 	__uint32_t		xs_attr_get;
107 	__uint32_t		xs_attr_set;
108 	__uint32_t		xs_attr_remove;
109 	__uint32_t		xs_attr_list;
110 # define XFSSTAT_END_INODE_CLUSTER	(XFSSTAT_END_ATTRIBUTE_OPS+3)
111 	__uint32_t		xs_iflush_count;
112 	__uint32_t		xs_icluster_flushcnt;
113 	__uint32_t		xs_icluster_flushinode;
114 # define XFSSTAT_END_VNODE_OPS		(XFSSTAT_END_INODE_CLUSTER+8)
115 	__uint32_t		vn_active;	/* # vnodes not on free lists */
116 	__uint32_t		vn_alloc;	/* # times vn_alloc called */
117 	__uint32_t		vn_get;		/* # times vn_get called */
118 	__uint32_t		vn_hold;	/* # times vn_hold called */
119 	__uint32_t		vn_rele;	/* # times vn_rele called */
120 	__uint32_t		vn_reclaim;	/* # times vn_reclaim called */
121 	__uint32_t		vn_remove;	/* # times vn_remove called */
122 	__uint32_t		vn_free;	/* # times vn_free called */
123 #define XFSSTAT_END_BUF			(XFSSTAT_END_VNODE_OPS+9)
124 	__uint32_t		pb_get;
125 	__uint32_t		pb_create;
126 	__uint32_t		pb_get_locked;
127 	__uint32_t		pb_get_locked_waited;
128 	__uint32_t		pb_busy_locked;
129 	__uint32_t		pb_miss_locked;
130 	__uint32_t		pb_page_retries;
131 	__uint32_t		pb_page_found;
132 	__uint32_t		pb_get_read;
133 /* Extra precision counters */
134 	__uint64_t		xs_xstrat_bytes;
135 	__uint64_t		xs_write_bytes;
136 	__uint64_t		xs_read_bytes;
137 };
138 
139 extern struct xfsstats xfsstats;
140 
141 # define XFS_STATS_INC(count)		( xfsstats.count++ )
142 # define XFS_STATS_DEC(count)		( xfsstats.count-- )
143 # define XFS_STATS_ADD(count, inc)	( xfsstats.count += (inc) )
144 
145 extern void xfs_init_procfs(void);
146 extern void xfs_cleanup_procfs(void);
147 
148 
149 #else	/* !CONFIG_PROC_FS */
150 
151 # define XFS_STATS_INC(count)
152 # define XFS_STATS_DEC(count)
153 # define XFS_STATS_ADD(count, inc)
154 
xfs_init_procfs(void)155 static __inline void xfs_init_procfs(void) { };
xfs_cleanup_procfs(void)156 static __inline void xfs_cleanup_procfs(void) { };
157 
158 #endif	/* !CONFIG_PROC_FS */
159 
160 #endif /* __XFS_STATS_H__ */
161