| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
| Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 2 | * Copyright (c) 2000,2005 Silicon Graphics, Inc. | 
|  | 3 | * All Rights Reserved. | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | * | 
| Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 5 | * This program is free software; you can redistribute it and/or | 
|  | 6 | * modify it under the terms of the GNU General Public License as | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | * published by the Free Software Foundation. | 
|  | 8 | * | 
| Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 9 | * This program is distributed in the hope that it would be useful, | 
|  | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|  | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|  | 12 | * GNU General Public License for more details. | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | * | 
| Nathan Scott | 7b71876 | 2005-11-02 14:58:39 +1100 | [diff] [blame] | 14 | * You should have received a copy of the GNU General Public License | 
|  | 15 | * along with this program; if not, write the Free Software Foundation, | 
|  | 16 | * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | */ | 
|  | 18 | #ifndef __XFS_STATS_H__ | 
|  | 19 | #define __XFS_STATS_H__ | 
|  | 20 |  | 
|  | 21 |  | 
|  | 22 | #if defined(CONFIG_PROC_FS) && !defined(XFS_STATS_OFF) | 
|  | 23 |  | 
|  | 24 | #include <linux/percpu.h> | 
|  | 25 |  | 
|  | 26 | /* | 
|  | 27 | * XFS global statistics | 
|  | 28 | */ | 
|  | 29 | struct xfsstats { | 
|  | 30 | # define XFSSTAT_END_EXTENT_ALLOC	4 | 
|  | 31 | __uint32_t		xs_allocx; | 
|  | 32 | __uint32_t		xs_allocb; | 
|  | 33 | __uint32_t		xs_freex; | 
|  | 34 | __uint32_t		xs_freeb; | 
|  | 35 | # define XFSSTAT_END_ALLOC_BTREE	(XFSSTAT_END_EXTENT_ALLOC+4) | 
|  | 36 | __uint32_t		xs_abt_lookup; | 
|  | 37 | __uint32_t		xs_abt_compare; | 
|  | 38 | __uint32_t		xs_abt_insrec; | 
|  | 39 | __uint32_t		xs_abt_delrec; | 
|  | 40 | # define XFSSTAT_END_BLOCK_MAPPING	(XFSSTAT_END_ALLOC_BTREE+7) | 
|  | 41 | __uint32_t		xs_blk_mapr; | 
|  | 42 | __uint32_t		xs_blk_mapw; | 
|  | 43 | __uint32_t		xs_blk_unmap; | 
|  | 44 | __uint32_t		xs_add_exlist; | 
|  | 45 | __uint32_t		xs_del_exlist; | 
|  | 46 | __uint32_t		xs_look_exlist; | 
|  | 47 | __uint32_t		xs_cmp_exlist; | 
|  | 48 | # define XFSSTAT_END_BLOCK_MAP_BTREE	(XFSSTAT_END_BLOCK_MAPPING+4) | 
|  | 49 | __uint32_t		xs_bmbt_lookup; | 
|  | 50 | __uint32_t		xs_bmbt_compare; | 
|  | 51 | __uint32_t		xs_bmbt_insrec; | 
|  | 52 | __uint32_t		xs_bmbt_delrec; | 
|  | 53 | # define XFSSTAT_END_DIRECTORY_OPS	(XFSSTAT_END_BLOCK_MAP_BTREE+4) | 
|  | 54 | __uint32_t		xs_dir_lookup; | 
|  | 55 | __uint32_t		xs_dir_create; | 
|  | 56 | __uint32_t		xs_dir_remove; | 
|  | 57 | __uint32_t		xs_dir_getdents; | 
|  | 58 | # define XFSSTAT_END_TRANSACTIONS	(XFSSTAT_END_DIRECTORY_OPS+3) | 
|  | 59 | __uint32_t		xs_trans_sync; | 
|  | 60 | __uint32_t		xs_trans_async; | 
|  | 61 | __uint32_t		xs_trans_empty; | 
|  | 62 | # define XFSSTAT_END_INODE_OPS		(XFSSTAT_END_TRANSACTIONS+7) | 
|  | 63 | __uint32_t		xs_ig_attempts; | 
|  | 64 | __uint32_t		xs_ig_found; | 
|  | 65 | __uint32_t		xs_ig_frecycle; | 
|  | 66 | __uint32_t		xs_ig_missed; | 
|  | 67 | __uint32_t		xs_ig_dup; | 
|  | 68 | __uint32_t		xs_ig_reclaims; | 
|  | 69 | __uint32_t		xs_ig_attrchg; | 
|  | 70 | # define XFSSTAT_END_LOG_OPS		(XFSSTAT_END_INODE_OPS+5) | 
|  | 71 | __uint32_t		xs_log_writes; | 
|  | 72 | __uint32_t		xs_log_blocks; | 
|  | 73 | __uint32_t		xs_log_noiclogs; | 
|  | 74 | __uint32_t		xs_log_force; | 
|  | 75 | __uint32_t		xs_log_force_sleep; | 
|  | 76 | # define XFSSTAT_END_TAIL_PUSHING	(XFSSTAT_END_LOG_OPS+10) | 
|  | 77 | __uint32_t		xs_try_logspace; | 
|  | 78 | __uint32_t		xs_sleep_logspace; | 
|  | 79 | __uint32_t		xs_push_ail; | 
|  | 80 | __uint32_t		xs_push_ail_success; | 
|  | 81 | __uint32_t		xs_push_ail_pushbuf; | 
|  | 82 | __uint32_t		xs_push_ail_pinned; | 
|  | 83 | __uint32_t		xs_push_ail_locked; | 
|  | 84 | __uint32_t		xs_push_ail_flushing; | 
|  | 85 | __uint32_t		xs_push_ail_restarts; | 
|  | 86 | __uint32_t		xs_push_ail_flush; | 
|  | 87 | # define XFSSTAT_END_WRITE_CONVERT	(XFSSTAT_END_TAIL_PUSHING+2) | 
|  | 88 | __uint32_t		xs_xstrat_quick; | 
|  | 89 | __uint32_t		xs_xstrat_split; | 
|  | 90 | # define XFSSTAT_END_READ_WRITE_OPS	(XFSSTAT_END_WRITE_CONVERT+2) | 
|  | 91 | __uint32_t		xs_write_calls; | 
|  | 92 | __uint32_t		xs_read_calls; | 
|  | 93 | # define XFSSTAT_END_ATTRIBUTE_OPS	(XFSSTAT_END_READ_WRITE_OPS+4) | 
|  | 94 | __uint32_t		xs_attr_get; | 
|  | 95 | __uint32_t		xs_attr_set; | 
|  | 96 | __uint32_t		xs_attr_remove; | 
|  | 97 | __uint32_t		xs_attr_list; | 
|  | 98 | # define XFSSTAT_END_INODE_CLUSTER	(XFSSTAT_END_ATTRIBUTE_OPS+3) | 
|  | 99 | __uint32_t		xs_iflush_count; | 
|  | 100 | __uint32_t		xs_icluster_flushcnt; | 
|  | 101 | __uint32_t		xs_icluster_flushinode; | 
|  | 102 | # define XFSSTAT_END_VNODE_OPS		(XFSSTAT_END_INODE_CLUSTER+8) | 
|  | 103 | __uint32_t		vn_active;	/* # vnodes not on free lists */ | 
|  | 104 | __uint32_t		vn_alloc;	/* # times vn_alloc called */ | 
|  | 105 | __uint32_t		vn_get;		/* # times vn_get called */ | 
|  | 106 | __uint32_t		vn_hold;	/* # times vn_hold called */ | 
|  | 107 | __uint32_t		vn_rele;	/* # times vn_rele called */ | 
|  | 108 | __uint32_t		vn_reclaim;	/* # times vn_reclaim called */ | 
|  | 109 | __uint32_t		vn_remove;	/* # times vn_remove called */ | 
|  | 110 | __uint32_t		vn_free;	/* # times vn_free called */ | 
|  | 111 | #define XFSSTAT_END_BUF			(XFSSTAT_END_VNODE_OPS+9) | 
| Nathan Scott | ce8e922 | 2006-01-11 15:39:08 +1100 | [diff] [blame] | 112 | __uint32_t		xb_get; | 
|  | 113 | __uint32_t		xb_create; | 
|  | 114 | __uint32_t		xb_get_locked; | 
|  | 115 | __uint32_t		xb_get_locked_waited; | 
|  | 116 | __uint32_t		xb_busy_locked; | 
|  | 117 | __uint32_t		xb_miss_locked; | 
|  | 118 | __uint32_t		xb_page_retries; | 
|  | 119 | __uint32_t		xb_page_found; | 
|  | 120 | __uint32_t		xb_get_read; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | /* Extra precision counters */ | 
|  | 122 | __uint64_t		xs_xstrat_bytes; | 
|  | 123 | __uint64_t		xs_write_bytes; | 
|  | 124 | __uint64_t		xs_read_bytes; | 
|  | 125 | }; | 
|  | 126 |  | 
|  | 127 | DECLARE_PER_CPU(struct xfsstats, xfsstats); | 
|  | 128 |  | 
|  | 129 | /* | 
|  | 130 | * We don't disable preempt, not too worried about poking the | 
|  | 131 | * wrong CPU's stat for now (also aggregated before reporting). | 
|  | 132 | */ | 
|  | 133 | #define XFS_STATS_INC(v)	(per_cpu(xfsstats, current_cpu()).v++) | 
|  | 134 | #define XFS_STATS_DEC(v)	(per_cpu(xfsstats, current_cpu()).v--) | 
|  | 135 | #define XFS_STATS_ADD(v, inc)	(per_cpu(xfsstats, current_cpu()).v += (inc)) | 
|  | 136 |  | 
|  | 137 | extern void xfs_init_procfs(void); | 
|  | 138 | extern void xfs_cleanup_procfs(void); | 
|  | 139 |  | 
|  | 140 |  | 
|  | 141 | #else	/* !CONFIG_PROC_FS */ | 
|  | 142 |  | 
|  | 143 | # define XFS_STATS_INC(count) | 
|  | 144 | # define XFS_STATS_DEC(count) | 
|  | 145 | # define XFS_STATS_ADD(count, inc) | 
|  | 146 |  | 
|  | 147 | static __inline void xfs_init_procfs(void) { }; | 
|  | 148 | static __inline void xfs_cleanup_procfs(void) { }; | 
|  | 149 |  | 
|  | 150 | #endif	/* !CONFIG_PROC_FS */ | 
|  | 151 |  | 
|  | 152 | #endif /* __XFS_STATS_H__ */ |