1153323Srodrigc/*
2153323Srodrigc * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
3153323Srodrigc *
4153323Srodrigc * This program is free software; you can redistribute it and/or modify it
5153323Srodrigc * under the terms of version 2 of the GNU General Public License as
6153323Srodrigc * published by the Free Software Foundation.
7153323Srodrigc *
8153323Srodrigc * This program is distributed in the hope that it would be useful, but
9153323Srodrigc * WITHOUT ANY WARRANTY; without even the implied warranty of
10153323Srodrigc * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11153323Srodrigc *
12153323Srodrigc * Further, this software is distributed without any warranty that it is
13153323Srodrigc * free of the rightful claim of any third person regarding infringement
14153323Srodrigc * or the like.  Any license provided herein, whether implied or
15153323Srodrigc * otherwise, applies only to this software file.  Patent licenses, if
16153323Srodrigc * any, provided herein do not apply to combinations of this program with
17153323Srodrigc * other software, or any other product whatsoever.
18153323Srodrigc *
19153323Srodrigc * You should have received a copy of the GNU General Public License along
20153323Srodrigc * with this program; if not, write the Free Software Foundation, Inc., 59
21153323Srodrigc * Temple Place - Suite 330, Boston MA 02111-1307, USA.
22153323Srodrigc *
23153323Srodrigc * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24153323Srodrigc * Mountain View, CA  94043, or:
25153323Srodrigc *
26153323Srodrigc * http://www.sgi.com
27153323Srodrigc *
28153323Srodrigc * For further information regarding this notice, see:
29153323Srodrigc *
30153323Srodrigc * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
31153323Srodrigc */
32153323Srodrigc#ifndef __XFS_STATS_H__
33153323Srodrigc#define __XFS_STATS_H__
34153323Srodrigc
35153323Srodrigc
36153323Srodrigc#if !defined(XFS_STATS_OFF)
37153323Srodrigc
38153323Srodrigc/*
39153323Srodrigc * XFS global statistics
40153323Srodrigc */
41153323Srodrigcstruct xfsstats {
42153323Srodrigc# define XFSSTAT_END_EXTENT_ALLOC	4
43153323Srodrigc	__uint32_t		xs_allocx;
44153323Srodrigc	__uint32_t		xs_allocb;
45153323Srodrigc	__uint32_t		xs_freex;
46153323Srodrigc	__uint32_t		xs_freeb;
47153323Srodrigc# define XFSSTAT_END_ALLOC_BTREE	(XFSSTAT_END_EXTENT_ALLOC+4)
48153323Srodrigc	__uint32_t		xs_abt_lookup;
49153323Srodrigc	__uint32_t		xs_abt_compare;
50153323Srodrigc	__uint32_t		xs_abt_insrec;
51153323Srodrigc	__uint32_t		xs_abt_delrec;
52153323Srodrigc# define XFSSTAT_END_BLOCK_MAPPING	(XFSSTAT_END_ALLOC_BTREE+7)
53153323Srodrigc	__uint32_t		xs_blk_mapr;
54153323Srodrigc	__uint32_t		xs_blk_mapw;
55153323Srodrigc	__uint32_t		xs_blk_unmap;
56153323Srodrigc	__uint32_t		xs_add_exlist;
57153323Srodrigc	__uint32_t		xs_del_exlist;
58153323Srodrigc	__uint32_t		xs_look_exlist;
59153323Srodrigc	__uint32_t		xs_cmp_exlist;
60153323Srodrigc# define XFSSTAT_END_BLOCK_MAP_BTREE	(XFSSTAT_END_BLOCK_MAPPING+4)
61153323Srodrigc	__uint32_t		xs_bmbt_lookup;
62153323Srodrigc	__uint32_t		xs_bmbt_compare;
63153323Srodrigc	__uint32_t		xs_bmbt_insrec;
64153323Srodrigc	__uint32_t		xs_bmbt_delrec;
65153323Srodrigc# define XFSSTAT_END_DIRECTORY_OPS	(XFSSTAT_END_BLOCK_MAP_BTREE+4)
66153323Srodrigc	__uint32_t		xs_dir_lookup;
67153323Srodrigc	__uint32_t		xs_dir_create;
68153323Srodrigc	__uint32_t		xs_dir_remove;
69153323Srodrigc	__uint32_t		xs_dir_getdents;
70153323Srodrigc# define XFSSTAT_END_TRANSACTIONS	(XFSSTAT_END_DIRECTORY_OPS+3)
71153323Srodrigc	__uint32_t		xs_trans_sync;
72153323Srodrigc	__uint32_t		xs_trans_async;
73153323Srodrigc	__uint32_t		xs_trans_empty;
74153323Srodrigc# define XFSSTAT_END_INODE_OPS		(XFSSTAT_END_TRANSACTIONS+7)
75153323Srodrigc	__uint32_t		xs_ig_attempts;
76153323Srodrigc	__uint32_t		xs_ig_found;
77153323Srodrigc	__uint32_t		xs_ig_frecycle;
78153323Srodrigc	__uint32_t		xs_ig_missed;
79153323Srodrigc	__uint32_t		xs_ig_dup;
80153323Srodrigc	__uint32_t		xs_ig_reclaims;
81153323Srodrigc	__uint32_t		xs_ig_attrchg;
82153323Srodrigc# define XFSSTAT_END_LOG_OPS		(XFSSTAT_END_INODE_OPS+5)
83153323Srodrigc	__uint32_t		xs_log_writes;
84153323Srodrigc	__uint32_t		xs_log_blocks;
85153323Srodrigc	__uint32_t		xs_log_noiclogs;
86153323Srodrigc	__uint32_t		xs_log_force;
87153323Srodrigc	__uint32_t		xs_log_force_sleep;
88153323Srodrigc# define XFSSTAT_END_TAIL_PUSHING	(XFSSTAT_END_LOG_OPS+10)
89153323Srodrigc	__uint32_t		xs_try_logspace;
90153323Srodrigc	__uint32_t		xs_sleep_logspace;
91153323Srodrigc	__uint32_t		xs_push_ail;
92153323Srodrigc	__uint32_t		xs_push_ail_success;
93153323Srodrigc	__uint32_t		xs_push_ail_pushbuf;
94153323Srodrigc	__uint32_t		xs_push_ail_pinned;
95153323Srodrigc	__uint32_t		xs_push_ail_locked;
96153323Srodrigc	__uint32_t		xs_push_ail_flushing;
97153323Srodrigc	__uint32_t		xs_push_ail_restarts;
98153323Srodrigc	__uint32_t		xs_push_ail_flush;
99153323Srodrigc# define XFSSTAT_END_WRITE_CONVERT	(XFSSTAT_END_TAIL_PUSHING+2)
100153323Srodrigc	__uint32_t		xs_xstrat_quick;
101153323Srodrigc	__uint32_t		xs_xstrat_split;
102153323Srodrigc# define XFSSTAT_END_READ_WRITE_OPS	(XFSSTAT_END_WRITE_CONVERT+2)
103153323Srodrigc	__uint32_t		xs_write_calls;
104153323Srodrigc	__uint32_t		xs_read_calls;
105153323Srodrigc# define XFSSTAT_END_ATTRIBUTE_OPS	(XFSSTAT_END_READ_WRITE_OPS+4)
106153323Srodrigc	__uint32_t		xs_attr_get;
107153323Srodrigc	__uint32_t		xs_attr_set;
108153323Srodrigc	__uint32_t		xs_attr_remove;
109153323Srodrigc	__uint32_t		xs_attr_list;
110153323Srodrigc# define XFSSTAT_END_INODE_CLUSTER	(XFSSTAT_END_ATTRIBUTE_OPS+3)
111153323Srodrigc	__uint32_t		xs_iflush_count;
112153323Srodrigc	__uint32_t		xs_icluster_flushcnt;
113153323Srodrigc	__uint32_t		xs_icluster_flushinode;
114153323Srodrigc# define XFSSTAT_END_VNODE_OPS		(XFSSTAT_END_INODE_CLUSTER+8)
115153323Srodrigc	__uint32_t		vn_active;	/* # vnodes not on free lists */
116153323Srodrigc	__uint32_t		vn_alloc;	/* # times vn_alloc called */
117153323Srodrigc	__uint32_t		vn_get;		/* # times vn_get called */
118153323Srodrigc	__uint32_t		vn_hold;	/* # times vn_hold called */
119153323Srodrigc	__uint32_t		vn_rele;	/* # times vn_rele called */
120153323Srodrigc	__uint32_t		vn_reclaim;	/* # times vn_reclaim called */
121153323Srodrigc	__uint32_t		vn_remove;	/* # times vn_remove called */
122153323Srodrigc	__uint32_t		vn_free;	/* # times vn_free called */
123153323Srodrigc#define XFSSTAT_END_BUF			(XFSSTAT_END_VNODE_OPS+9)
124153323Srodrigc	__uint32_t		pb_get;
125153323Srodrigc	__uint32_t		pb_create;
126153323Srodrigc	__uint32_t		pb_get_locked;
127153323Srodrigc	__uint32_t		pb_get_locked_waited;
128153323Srodrigc	__uint32_t		pb_busy_locked;
129153323Srodrigc	__uint32_t		pb_miss_locked;
130153323Srodrigc	__uint32_t		pb_page_retries;
131153323Srodrigc	__uint32_t		pb_page_found;
132153323Srodrigc	__uint32_t		pb_get_read;
133153323Srodrigc/* Extra precision counters */
134153323Srodrigc	__uint64_t		xs_xstrat_bytes;
135153323Srodrigc	__uint64_t		xs_write_bytes;
136153323Srodrigc	__uint64_t		xs_read_bytes;
137153323Srodrigc};
138153323Srodrigc
139153323Srodrigcextern struct xfsstats xfsstats;
140153323Srodrigc
141153323Srodrigc# define XFS_STATS_INC(count)		( xfsstats.count++ )
142153323Srodrigc# define XFS_STATS_DEC(count)		( xfsstats.count-- )
143153323Srodrigc# define XFS_STATS_ADD(count, inc)	( xfsstats.count += (inc) )
144153323Srodrigc
145153323Srodrigcextern void xfs_init_procfs(void);
146153323Srodrigcextern void xfs_cleanup_procfs(void);
147153323Srodrigc
148153323Srodrigc
149153323Srodrigc#else	/* !CONFIG_PROC_FS */
150153323Srodrigc
151153323Srodrigc# define XFS_STATS_INC(count)
152153323Srodrigc# define XFS_STATS_DEC(count)
153153323Srodrigc# define XFS_STATS_ADD(count, inc)
154153323Srodrigc
155153323Srodrigcstatic __inline void xfs_init_procfs(void) { };
156153323Srodrigcstatic __inline void xfs_cleanup_procfs(void) { };
157153323Srodrigc
158153323Srodrigc#endif	/* !CONFIG_PROC_FS */
159153323Srodrigc
160153323Srodrigc#endif /* __XFS_STATS_H__ */
161153323Srodrigc
162