locking/refcounts: Include fewer headers in <linux/refcount.h>
[linux/fpc-iii.git] / fs / cifs / trace.h
blob67e413f6ee4d8fd1dbd1eede0a7b0a9e6442a9e3
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Copyright (C) 2018, Microsoft Corporation.
5 * Author(s): Steve French <stfrench@microsoft.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
15 * the GNU General Public License for more details.
17 #undef TRACE_SYSTEM
18 #define TRACE_SYSTEM cifs
20 #if !defined(_CIFS_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
21 #define _CIFS_TRACE_H
23 #include <linux/tracepoint.h>
25 /* For logging errors in read or write */
26 DECLARE_EVENT_CLASS(smb3_rw_err_class,
27 TP_PROTO(unsigned int xid,
28 __u64 fid,
29 __u32 tid,
30 __u64 sesid,
31 __u64 offset,
32 __u32 len,
33 int rc),
34 TP_ARGS(xid, fid, tid, sesid, offset, len, rc),
35 TP_STRUCT__entry(
36 __field(unsigned int, xid)
37 __field(__u64, fid)
38 __field(__u32, tid)
39 __field(__u64, sesid)
40 __field(__u64, offset)
41 __field(__u32, len)
42 __field(int, rc)
44 TP_fast_assign(
45 __entry->xid = xid;
46 __entry->fid = fid;
47 __entry->tid = tid;
48 __entry->sesid = sesid;
49 __entry->offset = offset;
50 __entry->len = len;
51 __entry->rc = rc;
53 TP_printk("\txid=%u sid=0x%llx tid=0x%x fid=0x%llx offset=0x%llx len=0x%x rc=%d",
54 __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
55 __entry->offset, __entry->len, __entry->rc)
58 #define DEFINE_SMB3_RW_ERR_EVENT(name) \
59 DEFINE_EVENT(smb3_rw_err_class, smb3_##name, \
60 TP_PROTO(unsigned int xid, \
61 __u64 fid, \
62 __u32 tid, \
63 __u64 sesid, \
64 __u64 offset, \
65 __u32 len, \
66 int rc), \
67 TP_ARGS(xid, fid, tid, sesid, offset, len, rc))
69 DEFINE_SMB3_RW_ERR_EVENT(write_err);
70 DEFINE_SMB3_RW_ERR_EVENT(read_err);
73 /* For logging successful read or write */
74 DECLARE_EVENT_CLASS(smb3_rw_done_class,
75 TP_PROTO(unsigned int xid,
76 __u64 fid,
77 __u32 tid,
78 __u64 sesid,
79 __u64 offset,
80 __u32 len),
81 TP_ARGS(xid, fid, tid, sesid, offset, len),
82 TP_STRUCT__entry(
83 __field(unsigned int, xid)
84 __field(__u64, fid)
85 __field(__u32, tid)
86 __field(__u64, sesid)
87 __field(__u64, offset)
88 __field(__u32, len)
90 TP_fast_assign(
91 __entry->xid = xid;
92 __entry->fid = fid;
93 __entry->tid = tid;
94 __entry->sesid = sesid;
95 __entry->offset = offset;
96 __entry->len = len;
98 TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx offset=0x%llx len=0x%x",
99 __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
100 __entry->offset, __entry->len)
103 #define DEFINE_SMB3_RW_DONE_EVENT(name) \
104 DEFINE_EVENT(smb3_rw_done_class, smb3_##name, \
105 TP_PROTO(unsigned int xid, \
106 __u64 fid, \
107 __u32 tid, \
108 __u64 sesid, \
109 __u64 offset, \
110 __u32 len), \
111 TP_ARGS(xid, fid, tid, sesid, offset, len))
113 DEFINE_SMB3_RW_DONE_EVENT(write_done);
114 DEFINE_SMB3_RW_DONE_EVENT(read_done);
117 * For handle based calls other than read and write, and get/set info
119 DECLARE_EVENT_CLASS(smb3_fd_err_class,
120 TP_PROTO(unsigned int xid,
121 __u64 fid,
122 __u32 tid,
123 __u64 sesid,
124 int rc),
125 TP_ARGS(xid, fid, tid, sesid, rc),
126 TP_STRUCT__entry(
127 __field(unsigned int, xid)
128 __field(__u64, fid)
129 __field(__u32, tid)
130 __field(__u64, sesid)
131 __field(int, rc)
133 TP_fast_assign(
134 __entry->xid = xid;
135 __entry->fid = fid;
136 __entry->tid = tid;
137 __entry->sesid = sesid;
138 __entry->rc = rc;
140 TP_printk("\txid=%u sid=0x%llx tid=0x%x fid=0x%llx rc=%d",
141 __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
142 __entry->rc)
145 #define DEFINE_SMB3_FD_ERR_EVENT(name) \
146 DEFINE_EVENT(smb3_fd_err_class, smb3_##name, \
147 TP_PROTO(unsigned int xid, \
148 __u64 fid, \
149 __u32 tid, \
150 __u64 sesid, \
151 int rc), \
152 TP_ARGS(xid, fid, tid, sesid, rc))
154 DEFINE_SMB3_FD_ERR_EVENT(flush_err);
155 DEFINE_SMB3_FD_ERR_EVENT(lock_err);
156 DEFINE_SMB3_FD_ERR_EVENT(close_err);
159 * For handle based query/set info calls
161 DECLARE_EVENT_CLASS(smb3_inf_err_class,
162 TP_PROTO(unsigned int xid,
163 __u64 fid,
164 __u32 tid,
165 __u64 sesid,
166 __u8 infclass,
167 __u32 type,
168 int rc),
169 TP_ARGS(xid, fid, tid, sesid, infclass, type, rc),
170 TP_STRUCT__entry(
171 __field(unsigned int, xid)
172 __field(__u64, fid)
173 __field(__u32, tid)
174 __field(__u64, sesid)
175 __field(__u8, infclass)
176 __field(__u32, type)
177 __field(int, rc)
179 TP_fast_assign(
180 __entry->xid = xid;
181 __entry->fid = fid;
182 __entry->tid = tid;
183 __entry->sesid = sesid;
184 __entry->infclass = infclass;
185 __entry->type = type;
186 __entry->rc = rc;
188 TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx class=%u type=0x%x rc=%d",
189 __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
190 __entry->infclass, __entry->type, __entry->rc)
193 #define DEFINE_SMB3_INF_ERR_EVENT(name) \
194 DEFINE_EVENT(smb3_inf_err_class, smb3_##name, \
195 TP_PROTO(unsigned int xid, \
196 __u64 fid, \
197 __u32 tid, \
198 __u64 sesid, \
199 __u8 infclass, \
200 __u32 type, \
201 int rc), \
202 TP_ARGS(xid, fid, tid, sesid, infclass, type, rc))
204 DEFINE_SMB3_INF_ERR_EVENT(query_info_err);
205 DEFINE_SMB3_INF_ERR_EVENT(set_info_err);
206 DEFINE_SMB3_INF_ERR_EVENT(fsctl_err);
209 * For logging SMB3 Status code and Command for responses which return errors
211 DECLARE_EVENT_CLASS(smb3_cmd_err_class,
212 TP_PROTO(__u32 tid,
213 __u64 sesid,
214 __u16 cmd,
215 __u64 mid,
216 __u32 status,
217 int rc),
218 TP_ARGS(tid, sesid, cmd, mid, status, rc),
219 TP_STRUCT__entry(
220 __field(__u32, tid)
221 __field(__u64, sesid)
222 __field(__u16, cmd)
223 __field(__u64, mid)
224 __field(__u32, status)
225 __field(int, rc)
227 TP_fast_assign(
228 __entry->tid = tid;
229 __entry->sesid = sesid;
230 __entry->cmd = cmd;
231 __entry->mid = mid;
232 __entry->status = status;
233 __entry->rc = rc;
235 TP_printk("\tsid=0x%llx tid=0x%x cmd=%u mid=%llu status=0x%x rc=%d",
236 __entry->sesid, __entry->tid, __entry->cmd, __entry->mid,
237 __entry->status, __entry->rc)
240 #define DEFINE_SMB3_CMD_ERR_EVENT(name) \
241 DEFINE_EVENT(smb3_cmd_err_class, smb3_##name, \
242 TP_PROTO(__u32 tid, \
243 __u64 sesid, \
244 __u16 cmd, \
245 __u64 mid, \
246 __u32 status, \
247 int rc), \
248 TP_ARGS(tid, sesid, cmd, mid, status, rc))
250 DEFINE_SMB3_CMD_ERR_EVENT(cmd_err);
252 DECLARE_EVENT_CLASS(smb3_cmd_done_class,
253 TP_PROTO(__u32 tid,
254 __u64 sesid,
255 __u16 cmd,
256 __u64 mid),
257 TP_ARGS(tid, sesid, cmd, mid),
258 TP_STRUCT__entry(
259 __field(__u32, tid)
260 __field(__u64, sesid)
261 __field(__u16, cmd)
262 __field(__u64, mid)
264 TP_fast_assign(
265 __entry->tid = tid;
266 __entry->sesid = sesid;
267 __entry->cmd = cmd;
268 __entry->mid = mid;
270 TP_printk("\tsid=0x%llx tid=0x%x cmd=%u mid=%llu",
271 __entry->sesid, __entry->tid,
272 __entry->cmd, __entry->mid)
275 #define DEFINE_SMB3_CMD_DONE_EVENT(name) \
276 DEFINE_EVENT(smb3_cmd_done_class, smb3_##name, \
277 TP_PROTO(__u32 tid, \
278 __u64 sesid, \
279 __u16 cmd, \
280 __u64 mid), \
281 TP_ARGS(tid, sesid, cmd, mid))
283 DEFINE_SMB3_CMD_DONE_EVENT(cmd_done);
285 DECLARE_EVENT_CLASS(smb3_exit_err_class,
286 TP_PROTO(unsigned int xid,
287 const char *func_name,
288 int rc),
289 TP_ARGS(xid, func_name, rc),
290 TP_STRUCT__entry(
291 __field(unsigned int, xid)
292 __field(const char *, func_name)
293 __field(int, rc)
295 TP_fast_assign(
296 __entry->xid = xid;
297 __entry->func_name = func_name;
298 __entry->rc = rc;
300 TP_printk("\t%s: xid=%u rc=%d",
301 __entry->func_name, __entry->xid, __entry->rc)
304 #define DEFINE_SMB3_EXIT_ERR_EVENT(name) \
305 DEFINE_EVENT(smb3_exit_err_class, smb3_##name, \
306 TP_PROTO(unsigned int xid, \
307 const char *func_name, \
308 int rc), \
309 TP_ARGS(xid, func_name, rc))
311 DEFINE_SMB3_EXIT_ERR_EVENT(exit_err);
313 DECLARE_EVENT_CLASS(smb3_enter_exit_class,
314 TP_PROTO(unsigned int xid,
315 const char *func_name),
316 TP_ARGS(xid, func_name),
317 TP_STRUCT__entry(
318 __field(unsigned int, xid)
319 __field(const char *, func_name)
321 TP_fast_assign(
322 __entry->xid = xid;
323 __entry->func_name = func_name;
325 TP_printk("\t%s: xid=%u",
326 __entry->func_name, __entry->xid)
329 #define DEFINE_SMB3_ENTER_EXIT_EVENT(name) \
330 DEFINE_EVENT(smb3_enter_exit_class, smb3_##name, \
331 TP_PROTO(unsigned int xid, \
332 const char *func_name), \
333 TP_ARGS(xid, func_name))
335 DEFINE_SMB3_ENTER_EXIT_EVENT(enter);
336 DEFINE_SMB3_ENTER_EXIT_EVENT(exit_done);
339 * For smb2/smb3 open call
341 DECLARE_EVENT_CLASS(smb3_open_err_class,
342 TP_PROTO(unsigned int xid,
343 __u32 tid,
344 __u64 sesid,
345 int create_options,
346 int desired_access,
347 int rc),
348 TP_ARGS(xid, tid, sesid, create_options, desired_access, rc),
349 TP_STRUCT__entry(
350 __field(unsigned int, xid)
351 __field(__u32, tid)
352 __field(__u64, sesid)
353 __field(int, create_options)
354 __field(int, desired_access)
355 __field(int, rc)
357 TP_fast_assign(
358 __entry->xid = xid;
359 __entry->tid = tid;
360 __entry->sesid = sesid;
361 __entry->create_options = create_options;
362 __entry->desired_access = desired_access;
363 __entry->rc = rc;
365 TP_printk("xid=%u sid=0x%llx tid=0x%x cr_opts=0x%x des_access=0x%x rc=%d",
366 __entry->xid, __entry->sesid, __entry->tid,
367 __entry->create_options, __entry->desired_access, __entry->rc)
370 #define DEFINE_SMB3_OPEN_ERR_EVENT(name) \
371 DEFINE_EVENT(smb3_open_err_class, smb3_##name, \
372 TP_PROTO(unsigned int xid, \
373 __u32 tid, \
374 __u64 sesid, \
375 int create_options, \
376 int desired_access, \
377 int rc), \
378 TP_ARGS(xid, tid, sesid, create_options, desired_access, rc))
380 DEFINE_SMB3_OPEN_ERR_EVENT(open_err);
381 DEFINE_SMB3_OPEN_ERR_EVENT(posix_mkdir_err);
383 DECLARE_EVENT_CLASS(smb3_open_done_class,
384 TP_PROTO(unsigned int xid,
385 __u64 fid,
386 __u32 tid,
387 __u64 sesid,
388 int create_options,
389 int desired_access),
390 TP_ARGS(xid, fid, tid, sesid, create_options, desired_access),
391 TP_STRUCT__entry(
392 __field(unsigned int, xid)
393 __field(__u64, fid)
394 __field(__u32, tid)
395 __field(__u64, sesid)
396 __field(int, create_options)
397 __field(int, desired_access)
399 TP_fast_assign(
400 __entry->xid = xid;
401 __entry->fid = fid;
402 __entry->tid = tid;
403 __entry->sesid = sesid;
404 __entry->create_options = create_options;
405 __entry->desired_access = desired_access;
407 TP_printk("xid=%u sid=0x%llx tid=0x%x fid=0x%llx cr_opts=0x%x des_access=0x%x",
408 __entry->xid, __entry->sesid, __entry->tid, __entry->fid,
409 __entry->create_options, __entry->desired_access)
412 #define DEFINE_SMB3_OPEN_DONE_EVENT(name) \
413 DEFINE_EVENT(smb3_open_done_class, smb3_##name, \
414 TP_PROTO(unsigned int xid, \
415 __u64 fid, \
416 __u32 tid, \
417 __u64 sesid, \
418 int create_options, \
419 int desired_access), \
420 TP_ARGS(xid, fid, tid, sesid, create_options, desired_access))
422 DEFINE_SMB3_OPEN_DONE_EVENT(open_done);
423 DEFINE_SMB3_OPEN_DONE_EVENT(posix_mkdir_done);
425 #endif /* _CIFS_TRACE_H */
427 #undef TRACE_INCLUDE_PATH
428 #define TRACE_INCLUDE_PATH .
429 #define TRACE_INCLUDE_FILE trace
430 #include <trace/define_trace.h>