xfs_dir2_trace.c 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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. #include "xfs.h"
  33. #include "xfs_fs.h"
  34. #include "xfs_types.h"
  35. #include "xfs_inum.h"
  36. #include "xfs_dir.h"
  37. #include "xfs_dir2.h"
  38. #include "xfs_da_btree.h"
  39. #include "xfs_bmap_btree.h"
  40. #include "xfs_dir_sf.h"
  41. #include "xfs_dir2_sf.h"
  42. #include "xfs_attr_sf.h"
  43. #include "xfs_dinode.h"
  44. #include "xfs_inode.h"
  45. #include "xfs_dir2_trace.h"
  46. #ifdef XFS_DIR2_TRACE
  47. ktrace_t *xfs_dir2_trace_buf;
  48. /*
  49. * Enter something in the trace buffers.
  50. */
  51. static void
  52. xfs_dir2_trace_enter(
  53. xfs_inode_t *dp,
  54. int type,
  55. char *where,
  56. char *name,
  57. int namelen,
  58. void *a0,
  59. void *a1,
  60. void *a2,
  61. void *a3,
  62. void *a4,
  63. void *a5,
  64. void *a6,
  65. void *a7)
  66. {
  67. void *n[5];
  68. ASSERT(xfs_dir2_trace_buf);
  69. ASSERT(dp->i_dir_trace);
  70. if (name)
  71. memcpy(n, name, min((int)sizeof(n), namelen));
  72. else
  73. memset((char *)n, 0, sizeof(n));
  74. ktrace_enter(xfs_dir2_trace_buf,
  75. (void *)(long)type, (void *)where,
  76. (void *)a0, (void *)a1, (void *)a2, (void *)a3,
  77. (void *)a4, (void *)a5, (void *)a6, (void *)a7,
  78. (void *)(long)namelen,
  79. (void *)n[0], (void *)n[1], (void *)n[2],
  80. (void *)n[3], (void *)n[4]);
  81. ktrace_enter(dp->i_dir_trace,
  82. (void *)(long)type, (void *)where,
  83. (void *)a0, (void *)a1, (void *)a2, (void *)a3,
  84. (void *)a4, (void *)a5, (void *)a6, (void *)a7,
  85. (void *)(long)namelen,
  86. (void *)n[0], (void *)n[1], (void *)n[2],
  87. (void *)n[3], (void *)n[4]);
  88. }
  89. void
  90. xfs_dir2_trace_args(
  91. char *where,
  92. xfs_da_args_t *args)
  93. {
  94. xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS, where,
  95. (char *)args->name, (int)args->namelen,
  96. (void *)(unsigned long)args->hashval,
  97. (void *)((unsigned long)(args->inumber >> 32)),
  98. (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
  99. (void *)args->dp, (void *)args->trans,
  100. (void *)(unsigned long)args->justcheck, NULL, NULL);
  101. }
  102. void
  103. xfs_dir2_trace_args_b(
  104. char *where,
  105. xfs_da_args_t *args,
  106. xfs_dabuf_t *bp)
  107. {
  108. xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_B, where,
  109. (char *)args->name, (int)args->namelen,
  110. (void *)(unsigned long)args->hashval,
  111. (void *)((unsigned long)(args->inumber >> 32)),
  112. (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
  113. (void *)args->dp, (void *)args->trans,
  114. (void *)(unsigned long)args->justcheck,
  115. (void *)(bp ? bp->bps[0] : NULL), NULL);
  116. }
  117. void
  118. xfs_dir2_trace_args_bb(
  119. char *where,
  120. xfs_da_args_t *args,
  121. xfs_dabuf_t *lbp,
  122. xfs_dabuf_t *dbp)
  123. {
  124. xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_BB, where,
  125. (char *)args->name, (int)args->namelen,
  126. (void *)(unsigned long)args->hashval,
  127. (void *)((unsigned long)(args->inumber >> 32)),
  128. (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
  129. (void *)args->dp, (void *)args->trans,
  130. (void *)(unsigned long)args->justcheck,
  131. (void *)(lbp ? lbp->bps[0] : NULL),
  132. (void *)(dbp ? dbp->bps[0] : NULL));
  133. }
  134. void
  135. xfs_dir2_trace_args_bibii(
  136. char *where,
  137. xfs_da_args_t *args,
  138. xfs_dabuf_t *bs,
  139. int ss,
  140. xfs_dabuf_t *bd,
  141. int sd,
  142. int c)
  143. {
  144. xfs_buf_t *bpbs = bs ? bs->bps[0] : NULL;
  145. xfs_buf_t *bpbd = bd ? bd->bps[0] : NULL;
  146. xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_BIBII, where,
  147. (char *)args->name, (int)args->namelen,
  148. (void *)args->dp, (void *)args->trans,
  149. (void *)bpbs, (void *)(long)ss, (void *)bpbd, (void *)(long)sd,
  150. (void *)(long)c, NULL);
  151. }
  152. void
  153. xfs_dir2_trace_args_db(
  154. char *where,
  155. xfs_da_args_t *args,
  156. xfs_dir2_db_t db,
  157. xfs_dabuf_t *bp)
  158. {
  159. xfs_buf_t *dbp = bp ? bp->bps[0] : NULL;
  160. xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_DB, where,
  161. (char *)args->name, (int)args->namelen,
  162. (void *)(unsigned long)args->hashval,
  163. (void *)((unsigned long)(args->inumber >> 32)),
  164. (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
  165. (void *)args->dp, (void *)args->trans,
  166. (void *)(unsigned long)args->justcheck, (void *)(long)db,
  167. (void *)dbp);
  168. }
  169. void
  170. xfs_dir2_trace_args_i(
  171. char *where,
  172. xfs_da_args_t *args,
  173. xfs_ino_t i)
  174. {
  175. xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_I, where,
  176. (char *)args->name, (int)args->namelen,
  177. (void *)(unsigned long)args->hashval,
  178. (void *)((unsigned long)(args->inumber >> 32)),
  179. (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
  180. (void *)args->dp, (void *)args->trans,
  181. (void *)(unsigned long)args->justcheck,
  182. (void *)((unsigned long)(i >> 32)),
  183. (void *)((unsigned long)(i & 0xFFFFFFFF)));
  184. }
  185. void
  186. xfs_dir2_trace_args_s(
  187. char *where,
  188. xfs_da_args_t *args,
  189. int s)
  190. {
  191. xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_S, where,
  192. (char *)args->name, (int)args->namelen,
  193. (void *)(unsigned long)args->hashval,
  194. (void *)((unsigned long)(args->inumber >> 32)),
  195. (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
  196. (void *)args->dp, (void *)args->trans,
  197. (void *)(unsigned long)args->justcheck, (void *)(long)s, NULL);
  198. }
  199. void
  200. xfs_dir2_trace_args_sb(
  201. char *where,
  202. xfs_da_args_t *args,
  203. int s,
  204. xfs_dabuf_t *bp)
  205. {
  206. xfs_buf_t *dbp = bp ? bp->bps[0] : NULL;
  207. xfs_dir2_trace_enter(args->dp, XFS_DIR2_KTRACE_ARGS_SB, where,
  208. (char *)args->name, (int)args->namelen,
  209. (void *)(unsigned long)args->hashval,
  210. (void *)((unsigned long)(args->inumber >> 32)),
  211. (void *)((unsigned long)(args->inumber & 0xFFFFFFFF)),
  212. (void *)args->dp, (void *)args->trans,
  213. (void *)(unsigned long)args->justcheck, (void *)(long)s,
  214. (void *)dbp);
  215. }
  216. #endif /* XFS_DIR2_TRACE */