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