xfs_stats.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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. #if defined(CONFIG_PROC_FS) && !defined(XFS_STATS_OFF)
  21. #include <linux/percpu.h>
  22. /*
  23. * XFS global statistics
  24. */
  25. struct xfsstats {
  26. # define XFSSTAT_END_EXTENT_ALLOC 4
  27. __uint32_t xs_allocx;
  28. __uint32_t xs_allocb;
  29. __uint32_t xs_freex;
  30. __uint32_t xs_freeb;
  31. # define XFSSTAT_END_ALLOC_BTREE (XFSSTAT_END_EXTENT_ALLOC+4)
  32. __uint32_t xs_abt_lookup;
  33. __uint32_t xs_abt_compare;
  34. __uint32_t xs_abt_insrec;
  35. __uint32_t xs_abt_delrec;
  36. # define XFSSTAT_END_BLOCK_MAPPING (XFSSTAT_END_ALLOC_BTREE+7)
  37. __uint32_t xs_blk_mapr;
  38. __uint32_t xs_blk_mapw;
  39. __uint32_t xs_blk_unmap;
  40. __uint32_t xs_add_exlist;
  41. __uint32_t xs_del_exlist;
  42. __uint32_t xs_look_exlist;
  43. __uint32_t xs_cmp_exlist;
  44. # define XFSSTAT_END_BLOCK_MAP_BTREE (XFSSTAT_END_BLOCK_MAPPING+4)
  45. __uint32_t xs_bmbt_lookup;
  46. __uint32_t xs_bmbt_compare;
  47. __uint32_t xs_bmbt_insrec;
  48. __uint32_t xs_bmbt_delrec;
  49. # define XFSSTAT_END_DIRECTORY_OPS (XFSSTAT_END_BLOCK_MAP_BTREE+4)
  50. __uint32_t xs_dir_lookup;
  51. __uint32_t xs_dir_create;
  52. __uint32_t xs_dir_remove;
  53. __uint32_t xs_dir_getdents;
  54. # define XFSSTAT_END_TRANSACTIONS (XFSSTAT_END_DIRECTORY_OPS+3)
  55. __uint32_t xs_trans_sync;
  56. __uint32_t xs_trans_async;
  57. __uint32_t xs_trans_empty;
  58. # define XFSSTAT_END_INODE_OPS (XFSSTAT_END_TRANSACTIONS+7)
  59. __uint32_t xs_ig_attempts;
  60. __uint32_t xs_ig_found;
  61. __uint32_t xs_ig_frecycle;
  62. __uint32_t xs_ig_missed;
  63. __uint32_t xs_ig_dup;
  64. __uint32_t xs_ig_reclaims;
  65. __uint32_t xs_ig_attrchg;
  66. # define XFSSTAT_END_LOG_OPS (XFSSTAT_END_INODE_OPS+5)
  67. __uint32_t xs_log_writes;
  68. __uint32_t xs_log_blocks;
  69. __uint32_t xs_log_noiclogs;
  70. __uint32_t xs_log_force;
  71. __uint32_t xs_log_force_sleep;
  72. # define XFSSTAT_END_TAIL_PUSHING (XFSSTAT_END_LOG_OPS+10)
  73. __uint32_t xs_try_logspace;
  74. __uint32_t xs_sleep_logspace;
  75. __uint32_t xs_push_ail;
  76. __uint32_t xs_push_ail_success;
  77. __uint32_t xs_push_ail_pushbuf;
  78. __uint32_t xs_push_ail_pinned;
  79. __uint32_t xs_push_ail_locked;
  80. __uint32_t xs_push_ail_flushing;
  81. __uint32_t xs_push_ail_restarts;
  82. __uint32_t xs_push_ail_flush;
  83. # define XFSSTAT_END_WRITE_CONVERT (XFSSTAT_END_TAIL_PUSHING+2)
  84. __uint32_t xs_xstrat_quick;
  85. __uint32_t xs_xstrat_split;
  86. # define XFSSTAT_END_READ_WRITE_OPS (XFSSTAT_END_WRITE_CONVERT+2)
  87. __uint32_t xs_write_calls;
  88. __uint32_t xs_read_calls;
  89. # define XFSSTAT_END_ATTRIBUTE_OPS (XFSSTAT_END_READ_WRITE_OPS+4)
  90. __uint32_t xs_attr_get;
  91. __uint32_t xs_attr_set;
  92. __uint32_t xs_attr_remove;
  93. __uint32_t xs_attr_list;
  94. # define XFSSTAT_END_INODE_CLUSTER (XFSSTAT_END_ATTRIBUTE_OPS+3)
  95. __uint32_t xs_iflush_count;
  96. __uint32_t xs_icluster_flushcnt;
  97. __uint32_t xs_icluster_flushinode;
  98. # define XFSSTAT_END_VNODE_OPS (XFSSTAT_END_INODE_CLUSTER+8)
  99. __uint32_t vn_active; /* # vnodes not on free lists */
  100. __uint32_t vn_alloc; /* # times vn_alloc called */
  101. __uint32_t vn_get; /* # times vn_get called */
  102. __uint32_t vn_hold; /* # times vn_hold called */
  103. __uint32_t vn_rele; /* # times vn_rele called */
  104. __uint32_t vn_reclaim; /* # times vn_reclaim called */
  105. __uint32_t vn_remove; /* # times vn_remove called */
  106. __uint32_t vn_free; /* # times vn_free called */
  107. #define XFSSTAT_END_BUF (XFSSTAT_END_VNODE_OPS+9)
  108. __uint32_t xb_get;
  109. __uint32_t xb_create;
  110. __uint32_t xb_get_locked;
  111. __uint32_t xb_get_locked_waited;
  112. __uint32_t xb_busy_locked;
  113. __uint32_t xb_miss_locked;
  114. __uint32_t xb_page_retries;
  115. __uint32_t xb_page_found;
  116. __uint32_t xb_get_read;
  117. /* Extra precision counters */
  118. __uint64_t xs_xstrat_bytes;
  119. __uint64_t xs_write_bytes;
  120. __uint64_t xs_read_bytes;
  121. };
  122. DECLARE_PER_CPU(struct xfsstats, xfsstats);
  123. /*
  124. * We don't disable preempt, not too worried about poking the
  125. * wrong CPU's stat for now (also aggregated before reporting).
  126. */
  127. #define XFS_STATS_INC(v) (per_cpu(xfsstats, current_cpu()).v++)
  128. #define XFS_STATS_DEC(v) (per_cpu(xfsstats, current_cpu()).v--)
  129. #define XFS_STATS_ADD(v, inc) (per_cpu(xfsstats, current_cpu()).v += (inc))
  130. extern void xfs_init_procfs(void);
  131. extern void xfs_cleanup_procfs(void);
  132. #else /* !CONFIG_PROC_FS */
  133. # define XFS_STATS_INC(count)
  134. # define XFS_STATS_DEC(count)
  135. # define XFS_STATS_ADD(count, inc)
  136. static __inline void xfs_init_procfs(void) { };
  137. static __inline void xfs_cleanup_procfs(void) { };
  138. #endif /* !CONFIG_PROC_FS */
  139. #endif /* __XFS_STATS_H__ */