xfs_stats.h 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. /*
  2. * Copyright (c) 2000,2005 Silicon Graphics, Inc.
  3. * All Rights Reserved.
  4. *
  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
  7. * published by the Free Software Foundation.
  8. *
  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.
  13. *
  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
  17. */
  18. #ifndef __XFS_STATS_H__
  19. #define __XFS_STATS_H__
  20. #include <linux/percpu.h>
  21. /*
  22. * XFS global statistics
  23. */
  24. struct xfsstats {
  25. # define XFSSTAT_END_EXTENT_ALLOC 4
  26. __uint32_t xs_allocx;
  27. __uint32_t xs_allocb;
  28. __uint32_t xs_freex;
  29. __uint32_t xs_freeb;
  30. # define XFSSTAT_END_ALLOC_BTREE (XFSSTAT_END_EXTENT_ALLOC+4)
  31. __uint32_t xs_abt_lookup;
  32. __uint32_t xs_abt_compare;
  33. __uint32_t xs_abt_insrec;
  34. __uint32_t xs_abt_delrec;
  35. # define XFSSTAT_END_BLOCK_MAPPING (XFSSTAT_END_ALLOC_BTREE+7)
  36. __uint32_t xs_blk_mapr;
  37. __uint32_t xs_blk_mapw;
  38. __uint32_t xs_blk_unmap;
  39. __uint32_t xs_add_exlist;
  40. __uint32_t xs_del_exlist;
  41. __uint32_t xs_look_exlist;
  42. __uint32_t xs_cmp_exlist;
  43. # define XFSSTAT_END_BLOCK_MAP_BTREE (XFSSTAT_END_BLOCK_MAPPING+4)
  44. __uint32_t xs_bmbt_lookup;
  45. __uint32_t xs_bmbt_compare;
  46. __uint32_t xs_bmbt_insrec;
  47. __uint32_t xs_bmbt_delrec;
  48. # define XFSSTAT_END_DIRECTORY_OPS (XFSSTAT_END_BLOCK_MAP_BTREE+4)
  49. __uint32_t xs_dir_lookup;
  50. __uint32_t xs_dir_create;
  51. __uint32_t xs_dir_remove;
  52. __uint32_t xs_dir_getdents;
  53. # define XFSSTAT_END_TRANSACTIONS (XFSSTAT_END_DIRECTORY_OPS+3)
  54. __uint32_t xs_trans_sync;
  55. __uint32_t xs_trans_async;
  56. __uint32_t xs_trans_empty;
  57. # define XFSSTAT_END_INODE_OPS (XFSSTAT_END_TRANSACTIONS+7)
  58. __uint32_t xs_ig_attempts;
  59. __uint32_t xs_ig_found;
  60. __uint32_t xs_ig_frecycle;
  61. __uint32_t xs_ig_missed;
  62. __uint32_t xs_ig_dup;
  63. __uint32_t xs_ig_reclaims;
  64. __uint32_t xs_ig_attrchg;
  65. # define XFSSTAT_END_LOG_OPS (XFSSTAT_END_INODE_OPS+5)
  66. __uint32_t xs_log_writes;
  67. __uint32_t xs_log_blocks;
  68. __uint32_t xs_log_noiclogs;
  69. __uint32_t xs_log_force;
  70. __uint32_t xs_log_force_sleep;
  71. # define XFSSTAT_END_TAIL_PUSHING (XFSSTAT_END_LOG_OPS+10)
  72. __uint32_t xs_try_logspace;
  73. __uint32_t xs_sleep_logspace;
  74. __uint32_t xs_push_ail;
  75. __uint32_t xs_push_ail_success;
  76. __uint32_t xs_push_ail_pushbuf;
  77. __uint32_t xs_push_ail_pinned;
  78. __uint32_t xs_push_ail_locked;
  79. __uint32_t xs_push_ail_flushing;
  80. __uint32_t xs_push_ail_restarts;
  81. __uint32_t xs_push_ail_flush;
  82. # define XFSSTAT_END_WRITE_CONVERT (XFSSTAT_END_TAIL_PUSHING+2)
  83. __uint32_t xs_xstrat_quick;
  84. __uint32_t xs_xstrat_split;
  85. # define XFSSTAT_END_READ_WRITE_OPS (XFSSTAT_END_WRITE_CONVERT+2)
  86. __uint32_t xs_write_calls;
  87. __uint32_t xs_read_calls;
  88. # define XFSSTAT_END_ATTRIBUTE_OPS (XFSSTAT_END_READ_WRITE_OPS+4)
  89. __uint32_t xs_attr_get;
  90. __uint32_t xs_attr_set;
  91. __uint32_t xs_attr_remove;
  92. __uint32_t xs_attr_list;
  93. # define XFSSTAT_END_INODE_CLUSTER (XFSSTAT_END_ATTRIBUTE_OPS+3)
  94. __uint32_t xs_iflush_count;
  95. __uint32_t xs_icluster_flushcnt;
  96. __uint32_t xs_icluster_flushinode;
  97. # define XFSSTAT_END_VNODE_OPS (XFSSTAT_END_INODE_CLUSTER+8)
  98. __uint32_t vn_active; /* # vnodes not on free lists */
  99. __uint32_t vn_alloc; /* # times vn_alloc called */
  100. __uint32_t vn_get; /* # times vn_get called */
  101. __uint32_t vn_hold; /* # times vn_hold called */
  102. __uint32_t vn_rele; /* # times vn_rele called */
  103. __uint32_t vn_reclaim; /* # times vn_reclaim called */
  104. __uint32_t vn_remove; /* # times vn_remove called */
  105. __uint32_t vn_free; /* # times vn_free called */
  106. #define XFSSTAT_END_BUF (XFSSTAT_END_VNODE_OPS+9)
  107. __uint32_t xb_get;
  108. __uint32_t xb_create;
  109. __uint32_t xb_get_locked;
  110. __uint32_t xb_get_locked_waited;
  111. __uint32_t xb_busy_locked;
  112. __uint32_t xb_miss_locked;
  113. __uint32_t xb_page_retries;
  114. __uint32_t xb_page_found;
  115. __uint32_t xb_get_read;
  116. /* Version 2 btree counters */
  117. #define XFSSTAT_END_ABTB_V2 (XFSSTAT_END_BUF+15)
  118. __uint32_t xs_abtb_2_lookup;
  119. __uint32_t xs_abtb_2_compare;
  120. __uint32_t xs_abtb_2_insrec;
  121. __uint32_t xs_abtb_2_delrec;
  122. __uint32_t xs_abtb_2_newroot;
  123. __uint32_t xs_abtb_2_killroot;
  124. __uint32_t xs_abtb_2_increment;
  125. __uint32_t xs_abtb_2_decrement;
  126. __uint32_t xs_abtb_2_lshift;
  127. __uint32_t xs_abtb_2_rshift;
  128. __uint32_t xs_abtb_2_split;
  129. __uint32_t xs_abtb_2_join;
  130. __uint32_t xs_abtb_2_alloc;
  131. __uint32_t xs_abtb_2_free;
  132. __uint32_t xs_abtb_2_moves;
  133. #define XFSSTAT_END_ABTC_V2 (XFSSTAT_END_ABTB_V2+15)
  134. __uint32_t xs_abtc_2_lookup;
  135. __uint32_t xs_abtc_2_compare;
  136. __uint32_t xs_abtc_2_insrec;
  137. __uint32_t xs_abtc_2_delrec;
  138. __uint32_t xs_abtc_2_newroot;
  139. __uint32_t xs_abtc_2_killroot;
  140. __uint32_t xs_abtc_2_increment;
  141. __uint32_t xs_abtc_2_decrement;
  142. __uint32_t xs_abtc_2_lshift;
  143. __uint32_t xs_abtc_2_rshift;
  144. __uint32_t xs_abtc_2_split;
  145. __uint32_t xs_abtc_2_join;
  146. __uint32_t xs_abtc_2_alloc;
  147. __uint32_t xs_abtc_2_free;
  148. __uint32_t xs_abtc_2_moves;
  149. #define XFSSTAT_END_BMBT_V2 (XFSSTAT_END_ABTC_V2+15)
  150. __uint32_t xs_bmbt_2_lookup;
  151. __uint32_t xs_bmbt_2_compare;
  152. __uint32_t xs_bmbt_2_insrec;
  153. __uint32_t xs_bmbt_2_delrec;
  154. __uint32_t xs_bmbt_2_newroot;
  155. __uint32_t xs_bmbt_2_killroot;
  156. __uint32_t xs_bmbt_2_increment;
  157. __uint32_t xs_bmbt_2_decrement;
  158. __uint32_t xs_bmbt_2_lshift;
  159. __uint32_t xs_bmbt_2_rshift;
  160. __uint32_t xs_bmbt_2_split;
  161. __uint32_t xs_bmbt_2_join;
  162. __uint32_t xs_bmbt_2_alloc;
  163. __uint32_t xs_bmbt_2_free;
  164. __uint32_t xs_bmbt_2_moves;
  165. #define XFSSTAT_END_IBT_V2 (XFSSTAT_END_BMBT_V2+15)
  166. __uint32_t xs_ibt_2_lookup;
  167. __uint32_t xs_ibt_2_compare;
  168. __uint32_t xs_ibt_2_insrec;
  169. __uint32_t xs_ibt_2_delrec;
  170. __uint32_t xs_ibt_2_newroot;
  171. __uint32_t xs_ibt_2_killroot;
  172. __uint32_t xs_ibt_2_increment;
  173. __uint32_t xs_ibt_2_decrement;
  174. __uint32_t xs_ibt_2_lshift;
  175. __uint32_t xs_ibt_2_rshift;
  176. __uint32_t xs_ibt_2_split;
  177. __uint32_t xs_ibt_2_join;
  178. __uint32_t xs_ibt_2_alloc;
  179. __uint32_t xs_ibt_2_free;
  180. __uint32_t xs_ibt_2_moves;
  181. #define XFSSTAT_END_FIBT_V2 (XFSSTAT_END_IBT_V2+15)
  182. __uint32_t xs_fibt_2_lookup;
  183. __uint32_t xs_fibt_2_compare;
  184. __uint32_t xs_fibt_2_insrec;
  185. __uint32_t xs_fibt_2_delrec;
  186. __uint32_t xs_fibt_2_newroot;
  187. __uint32_t xs_fibt_2_killroot;
  188. __uint32_t xs_fibt_2_increment;
  189. __uint32_t xs_fibt_2_decrement;
  190. __uint32_t xs_fibt_2_lshift;
  191. __uint32_t xs_fibt_2_rshift;
  192. __uint32_t xs_fibt_2_split;
  193. __uint32_t xs_fibt_2_join;
  194. __uint32_t xs_fibt_2_alloc;
  195. __uint32_t xs_fibt_2_free;
  196. __uint32_t xs_fibt_2_moves;
  197. #define XFSSTAT_END_XQMSTAT (XFSSTAT_END_FIBT_V2+6)
  198. __uint32_t xs_qm_dqreclaims;
  199. __uint32_t xs_qm_dqreclaim_misses;
  200. __uint32_t xs_qm_dquot_dups;
  201. __uint32_t xs_qm_dqcachemisses;
  202. __uint32_t xs_qm_dqcachehits;
  203. __uint32_t xs_qm_dqwants;
  204. #define XFSSTAT_END_QM (XFSSTAT_END_XQMSTAT+2)
  205. __uint32_t xs_qm_dquot;
  206. __uint32_t xs_qm_dquot_unused;
  207. /* Extra precision counters */
  208. __uint64_t xs_xstrat_bytes;
  209. __uint64_t xs_write_bytes;
  210. __uint64_t xs_read_bytes;
  211. };
  212. int xfs_stats_format(struct xfsstats __percpu *stats, char *buf);
  213. void xfs_stats_clearall(struct xfsstats __percpu *stats);
  214. extern struct xstats xfsstats;
  215. #define XFS_STATS_INC(mp, v) \
  216. do { \
  217. per_cpu_ptr(xfsstats.xs_stats, current_cpu())->v++; \
  218. per_cpu_ptr(mp->m_stats.xs_stats, current_cpu())->v++; \
  219. } while (0)
  220. #define XFS_STATS_DEC(mp, v) \
  221. do { \
  222. per_cpu_ptr(xfsstats.xs_stats, current_cpu())->v--; \
  223. per_cpu_ptr(mp->m_stats.xs_stats, current_cpu())->v--; \
  224. } while (0)
  225. #define XFS_STATS_ADD(mp, v, inc) \
  226. do { \
  227. per_cpu_ptr(xfsstats.xs_stats, current_cpu())->v += (inc); \
  228. per_cpu_ptr(mp->m_stats.xs_stats, current_cpu())->v += (inc); \
  229. } while (0)
  230. #if defined(CONFIG_PROC_FS)
  231. extern int xfs_init_procfs(void);
  232. extern void xfs_cleanup_procfs(void);
  233. #else /* !CONFIG_PROC_FS */
  234. static inline int xfs_init_procfs(void)
  235. {
  236. return 0;
  237. }
  238. static inline void xfs_cleanup_procfs(void)
  239. {
  240. }
  241. #endif /* !CONFIG_PROC_FS */
  242. #endif /* __XFS_STATS_H__ */