1 /* 2 * Copyright (c) 2008 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_BTREE_TRACE_H__ 19 #define __XFS_BTREE_TRACE_H__ 20 21 struct xfs_btree_cur; 22 struct xfs_buf; 23 24 25 /* 26 * Trace hooks. 27 * i,j = integer (32 bit) 28 * b = btree block buffer (xfs_buf_t) 29 * p = btree ptr 30 * r = btree record 31 * k = btree key 32 */ 33 34 #ifdef XFS_BTREE_TRACE 35 36 /* 37 * Trace buffer entry types. 38 */ 39 #define XFS_BTREE_KTRACE_ARGBI 1 40 #define XFS_BTREE_KTRACE_ARGBII 2 41 #define XFS_BTREE_KTRACE_ARGFFFI 3 42 #define XFS_BTREE_KTRACE_ARGI 4 43 #define XFS_BTREE_KTRACE_ARGIPK 5 44 #define XFS_BTREE_KTRACE_ARGIPR 6 45 #define XFS_BTREE_KTRACE_ARGIK 7 46 #define XFS_BTREE_KTRACE_ARGR 8 47 #define XFS_BTREE_KTRACE_CUR 9 48 49 /* 50 * Sub-types for cursor traces. 51 */ 52 #define XBT_ARGS 0 53 #define XBT_ENTRY 1 54 #define XBT_ERROR 2 55 #define XBT_EXIT 3 56 57 void xfs_btree_trace_argbi(const char *, struct xfs_btree_cur *, 58 struct xfs_buf *, int, int); 59 void xfs_btree_trace_argbii(const char *, struct xfs_btree_cur *, 60 struct xfs_buf *, int, int, int); 61 void xfs_btree_trace_argfffi(const char *, struct xfs_btree_cur *, 62 xfs_dfiloff_t, xfs_dfsbno_t, xfs_dfilblks_t, int, int); 63 void xfs_btree_trace_argi(const char *, struct xfs_btree_cur *, int, int); 64 void xfs_btree_trace_argipk(const char *, struct xfs_btree_cur *, int, 65 union xfs_btree_ptr, union xfs_btree_key *, int); 66 void xfs_btree_trace_argipr(const char *, struct xfs_btree_cur *, int, 67 union xfs_btree_ptr, union xfs_btree_rec *, int); 68 void xfs_btree_trace_argik(const char *, struct xfs_btree_cur *, int, 69 union xfs_btree_key *, int); 70 void xfs_btree_trace_argr(const char *, struct xfs_btree_cur *, 71 union xfs_btree_rec *, int); 72 void xfs_btree_trace_cursor(const char *, struct xfs_btree_cur *, int, int); 73 74 75 #define XFS_ALLOCBT_TRACE_SIZE 4096 /* size of global trace buffer */ 76 extern ktrace_t *xfs_allocbt_trace_buf; 77 78 #define XFS_INOBT_TRACE_SIZE 4096 /* size of global trace buffer */ 79 extern ktrace_t *xfs_inobt_trace_buf; 80 81 #define XFS_BMBT_TRACE_SIZE 4096 /* size of global trace buffer */ 82 #define XFS_BMBT_KTRACE_SIZE 32 /* size of per-inode trace buffer */ 83 extern ktrace_t *xfs_bmbt_trace_buf; 84 85 86 #define XFS_BTREE_TRACE_ARGBI(c, b, i) \ 87 xfs_btree_trace_argbi(__func__, c, b, i, __LINE__) 88 #define XFS_BTREE_TRACE_ARGBII(c, b, i, j) \ 89 xfs_btree_trace_argbii(__func__, c, b, i, j, __LINE__) 90 #define XFS_BTREE_TRACE_ARGFFFI(c, o, b, i, j) \ 91 xfs_btree_trace_argfffi(__func__, c, o, b, i, j, __LINE__) 92 #define XFS_BTREE_TRACE_ARGI(c, i) \ 93 xfs_btree_trace_argi(__func__, c, i, __LINE__) 94 #define XFS_BTREE_TRACE_ARGIPK(c, i, p, k) \ 95 xfs_btree_trace_argipk(__func__, c, i, p, k, __LINE__) 96 #define XFS_BTREE_TRACE_ARGIPR(c, i, p, r) \ 97 xfs_btree_trace_argipr(__func__, c, i, p, r, __LINE__) 98 #define XFS_BTREE_TRACE_ARGIK(c, i, k) \ 99 xfs_btree_trace_argik(__func__, c, i, k, __LINE__) 100 #define XFS_BTREE_TRACE_ARGR(c, r) \ 101 xfs_btree_trace_argr(__func__, c, r, __LINE__) 102 #define XFS_BTREE_TRACE_CURSOR(c, t) \ 103 xfs_btree_trace_cursor(__func__, c, t, __LINE__) 104 #else 105 #define XFS_BTREE_TRACE_ARGBI(c, b, i) 106 #define XFS_BTREE_TRACE_ARGBII(c, b, i, j) 107 #define XFS_BTREE_TRACE_ARGFFFI(c, o, b, i, j) 108 #define XFS_BTREE_TRACE_ARGI(c, i) 109 #define XFS_BTREE_TRACE_ARGIPK(c, i, p, s) 110 #define XFS_BTREE_TRACE_ARGIPR(c, i, p, r) 111 #define XFS_BTREE_TRACE_ARGIK(c, i, k) 112 #define XFS_BTREE_TRACE_ARGR(c, r) 113 #define XFS_BTREE_TRACE_CURSOR(c, t) 114 #endif /* XFS_BTREE_TRACE */ 115 116 #endif /* __XFS_BTREE_TRACE_H__ */ 117