xfs_dir2_trace.c 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. /*
  2. * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms of version 2 of the GNU General Public License as
  6. * published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it would be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. *
  12. * Further, this software is distributed without any warranty that it is
  13. * free of the rightful claim of any third person regarding infringement
  14. * or the like. Any license provided herein, whether implied or
  15. * otherwise, applies only to this software file. Patent licenses, if
  16. * any, provided herein do not apply to combinations of this program with
  17. * other software, or any other product whatsoever.
  18. *
  19. * You should have received a copy of the GNU General Public License along
  20. * with this program; if not, write the Free Software Foundation, Inc., 59
  21. * Temple Place - Suite 330, Boston MA 02111-1307, USA.
  22. *
  23. * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
  24. * Mountain View, CA 94043, or:
  25. *
  26. * http://www.sgi.com
  27. *
  28. * For further information regarding this notice, see:
  29. *
  30. * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
  31. */
  32. /*
  33. * xfs_dir2_trace.c
  34. * Tracing for xfs v2 directories.
  35. */
  36. #include "xfs.h"
  37. #include "xfs_types.h"
  38. #include "xfs_inum.h"
  39. #include "xfs_dir.h"
  40. #include "xfs_dir2.h"
  41. #include "xfs_bmap_btree.h"
  42. #include "xfs_attr_sf.h"
  43. #include "xfs_dir_sf.h"
  44. #include "xfs_dir2_sf.h"
  45. #include "xfs_dinode.h"
  46. #include "xfs_inode.h"
  47. #include "xfs_da_btree.h"
  48. #include "xfs_dir2_trace.h"
  49. #ifdef XFS_DIR2_TRACE
  50. ktrace_t *xfs_dir2_trace_buf;
  51. /*
  52. * Enter something in the trace buffers.
  53. */
  54. static void
  55. xfs_dir2_trace_enter(
  56. xfs_inode_t *dp,
  57. int type,
  58. char *where,
  59. char *name,
  60. int namelen,
  61. void *a0,
  62. void *a1,
  63. void *a2,
  64. void *a3,
  65. void *a4,
  66. void *a5,
  67. void *a6,
  68. void *a7)
  69. {
  70. void *n[5];
  71. ASSERT(xfs_dir2_trace_buf);
  72. ASSERT(dp->i_dir_trace);
  73. if (name)
  74. memcpy(n, name, min((int)sizeof(n), namelen));
  75. else
  76. memset((char *)n, 0, sizeof(n));
  77. ktrace_enter(xfs_dir2_trace_buf,
  78. (void *)(long)type, (void *)where,
  79. (void *)a0, (void *)a1, (void *)a2, (void *)a3,
  80. (void *)a4, (void *)a5, (void *)a6, (void *)a7,
  81. (void *)(long)namelen,
  82. (void *)n[0], (void *)n[1], (void *)n[2],
  83. (void *)n[3], (void *)n[4]);
  84. ktrace_enter(dp->i_dir_trace,
  85. (void *)(long)type, (void *)where,
  86. (void *)a0, (void *)a1, (void *)a2, (void *)a3,
  87. (void *)a4, (void *)a5, (void *)a6, (void *)a7,
  88. (void *)(long)namelen,
  89. (void *)n[0], (void *)n[1], (void *)n[2],
  90. (void *)n[3], (void *)n[4]);
  91. }
  92. void
  93. xfs_dir2_trace_args(
  94. char *where,
  95. xfs_da_args_t *args)
  96. {
  97. xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS, where,
  98. (char *)args->name, (int)args->namelen,
  99. (void *)(unsigned long)args->hashval,
  100. (void *)((unsigned long)(args->inumber >> 32)),
  101. (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
  102. (void *)args->dp, (void *)args->trans,
  103. (void *)(unsigned long)args->justcheck, NULL, NULL);
  104. }
  105. void
  106. xfs_dir2_trace_args_b(
  107. char *where,
  108. xfs_da_args_t *args,
  109. xfs_dabuf_t *bp)
  110. {
  111. xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_B, where,
  112. (char *)args->name, (int)args->namelen,
  113. (void *)(unsigned long)args->hashval,
  114. (void *)((unsigned long)(args->inumber >> 32)),
  115. (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
  116. (void *)args->dp, (void *)args->trans,
  117. (void *)(unsigned long)args->justcheck,
  118. (void *)(bp ? bp->bps[0] : NULL), NULL);
  119. }
  120. void
  121. xfs_dir2_trace_args_bb(
  122. char *where,
  123. xfs_da_args_t *args,
  124. xfs_dabuf_t *lbp,
  125. xfs_dabuf_t *dbp)
  126. {
  127. xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_BB, where,
  128. (char *)args->name, (int)args->namelen,
  129. (void *)(unsigned long)args->hashval,
  130. (void *)((unsigned long)(args->inumber >> 32)),
  131. (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
  132. (void *)args->dp, (void *)args->trans,
  133. (void *)(unsigned long)args->justcheck,
  134. (void *)(lbp ? lbp->bps[0] : NULL),
  135. (void *)(dbp ? dbp->bps[0] : NULL));
  136. }
  137. void
  138. xfs_dir2_trace_args_bibii(
  139. char *where,
  140. xfs_da_args_t *args,
  141. xfs_dabuf_t *bs,
  142. int ss,
  143. xfs_dabuf_t *bd,
  144. int sd,
  145. int c)
  146. {
  147. xfs_buf_t *bpbs = bs ? bs->bps[0] : NULL;
  148. xfs_buf_t *bpbd = bd ? bd->bps[0] : NULL;
  149. xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_BIBII, where,
  150. (char *)args->name, (int)args->namelen,
  151. (void *)args->dp, (void *)args->trans,
  152. (void *)bpbs, (void *)(long)ss, (void *)bpbd, (void *)(long)sd,
  153. (void *)(long)c, NULL);
  154. }
  155. void
  156. xfs_dir2_trace_args_db(
  157. char *where,
  158. xfs_da_args_t *args,
  159. xfs_dir2_db_t db,
  160. xfs_dabuf_t *bp)
  161. {
  162. xfs_buf_t *dbp = bp ? bp->bps[0] : NULL;
  163. xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_DB, where,
  164. (char *)args->name, (int)args->namelen,
  165. (void *)(unsigned long)args->hashval,
  166. (void *)((unsigned long)(args->inumber >> 32)),
  167. (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
  168. (void *)args->dp, (void *)args->trans,
  169. (void *)(unsigned long)args->justcheck, (void *)(long)db,
  170. (void *)dbp);
  171. }
  172. void
  173. xfs_dir2_trace_args_i(
  174. char *where,
  175. xfs_da_args_t *args,
  176. xfs_ino_t i)
  177. {
  178. xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_I, where,
  179. (char *)args->name, (int)args->namelen,
  180. (void *)(unsigned long)args->hashval,
  181. (void *)((unsigned long)(args->inumber >> 32)),
  182. (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
  183. (void *)args->dp, (void *)args->trans,
  184. (void *)(unsigned long)args->justcheck,
  185. (void *)((unsigned long)(i >> 32)),
  186. (void *)((unsigned long)(i & 0xFFFFFFFF)));
  187. }
  188. void
  189. xfs_dir2_trace_args_s(
  190. char *where,
  191. xfs_da_args_t *args,
  192. int s)
  193. {
  194. xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_S, where,
  195. (char *)args->name, (int)args->namelen,
  196. (void *)(unsigned long)args->hashval,
  197. (void *)((unsigned long)(args->inumber >> 32)),
  198. (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
  199. (void *)args->dp, (void *)args->trans,
  200. (void *)(unsigned long)args->justcheck, (void *)(long)s, NULL);
  201. }
  202. void
  203. xfs_dir2_trace_args_sb(
  204. char *where,
  205. xfs_da_args_t *args,
  206. int s,
  207. xfs_dabuf_t *bp)
  208. {
  209. xfs_buf_t *dbp = bp ? bp->bps[0] : NULL;
  210. xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_SB, where,
  211. (char *)args->name, (int)args->namelen,
  212. (void *)(unsigned long)args->hashval,
  213. (void *)((unsigned long)(args->inumber >> 32)),
  214. (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
  215. (void *)args->dp, (void *)args->trans,
  216. (void *)(unsigned long)args->justcheck, (void *)(long)s,
  217. (void *)dbp);
  218. }
  219. #endif /* XFS_DIR2_TRACE */