xref: /linux/include/trace/events/netfs.h (revision 001821b0e79716c4e17c71d8e053a23599a7a508)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /* Network filesystem support module tracepoints
3  *
4  * Copyright (C) 2021 Red Hat, Inc. All Rights Reserved.
5  * Written by David Howells (dhowells@redhat.com)
6  */
7 #undef TRACE_SYSTEM
8 #define TRACE_SYSTEM netfs
9 
10 #if !defined(_TRACE_NETFS_H) || defined(TRACE_HEADER_MULTI_READ)
11 #define _TRACE_NETFS_H
12 
13 #include <linux/tracepoint.h>
14 
15 /*
16  * Define enums for tracing information.
17  */
18 #define netfs_read_traces					\
19 	EM(netfs_read_trace_dio_read,		"DIO-READ ")	\
20 	EM(netfs_read_trace_expanded,		"EXPANDED ")	\
21 	EM(netfs_read_trace_readahead,		"READAHEAD")	\
22 	EM(netfs_read_trace_readpage,		"READPAGE ")	\
23 	EM(netfs_read_trace_prefetch_for_write,	"PREFETCHW")	\
24 	E_(netfs_read_trace_write_begin,	"WRITEBEGN")
25 
26 #define netfs_write_traces					\
27 	EM(netfs_write_trace_copy_to_cache,	"COPY2CACH")	\
28 	EM(netfs_write_trace_dio_write,		"DIO-WRITE")	\
29 	EM(netfs_write_trace_unbuffered_write,	"UNB-WRITE")	\
30 	EM(netfs_write_trace_writeback,		"WRITEBACK")	\
31 	E_(netfs_write_trace_writethrough,	"WRITETHRU")
32 
33 #define netfs_rreq_origins					\
34 	EM(NETFS_READAHEAD,			"RA")		\
35 	EM(NETFS_READPAGE,			"RP")		\
36 	EM(NETFS_READ_FOR_WRITE,		"RW")		\
37 	EM(NETFS_COPY_TO_CACHE,			"CC")		\
38 	EM(NETFS_WRITEBACK,			"WB")		\
39 	EM(NETFS_WRITETHROUGH,			"WT")		\
40 	EM(NETFS_UNBUFFERED_WRITE,		"UW")		\
41 	EM(NETFS_DIO_READ,			"DR")		\
42 	E_(NETFS_DIO_WRITE,			"DW")
43 
44 #define netfs_rreq_traces					\
45 	EM(netfs_rreq_trace_assess,		"ASSESS ")	\
46 	EM(netfs_rreq_trace_copy,		"COPY   ")	\
47 	EM(netfs_rreq_trace_collect,		"COLLECT")	\
48 	EM(netfs_rreq_trace_done,		"DONE   ")	\
49 	EM(netfs_rreq_trace_free,		"FREE   ")	\
50 	EM(netfs_rreq_trace_redirty,		"REDIRTY")	\
51 	EM(netfs_rreq_trace_resubmit,		"RESUBMT")	\
52 	EM(netfs_rreq_trace_set_pause,		"PAUSE  ")	\
53 	EM(netfs_rreq_trace_unlock,		"UNLOCK ")	\
54 	EM(netfs_rreq_trace_unmark,		"UNMARK ")	\
55 	EM(netfs_rreq_trace_wait_ip,		"WAIT-IP")	\
56 	EM(netfs_rreq_trace_wait_pause,		"WT-PAUS")	\
57 	EM(netfs_rreq_trace_wake_ip,		"WAKE-IP")	\
58 	EM(netfs_rreq_trace_unpause,		"UNPAUSE")	\
59 	E_(netfs_rreq_trace_write_done,		"WR-DONE")
60 
61 #define netfs_sreq_sources					\
62 	EM(NETFS_FILL_WITH_ZEROES,		"ZERO")		\
63 	EM(NETFS_DOWNLOAD_FROM_SERVER,		"DOWN")		\
64 	EM(NETFS_READ_FROM_CACHE,		"READ")		\
65 	EM(NETFS_INVALID_READ,			"INVL")		\
66 	EM(NETFS_UPLOAD_TO_SERVER,		"UPLD")		\
67 	EM(NETFS_WRITE_TO_CACHE,		"WRIT")		\
68 	E_(NETFS_INVALID_WRITE,			"INVL")
69 
70 #define netfs_sreq_traces					\
71 	EM(netfs_sreq_trace_discard,		"DSCRD")	\
72 	EM(netfs_sreq_trace_download_instead,	"RDOWN")	\
73 	EM(netfs_sreq_trace_fail,		"FAIL ")	\
74 	EM(netfs_sreq_trace_free,		"FREE ")	\
75 	EM(netfs_sreq_trace_limited,		"LIMIT")	\
76 	EM(netfs_sreq_trace_prepare,		"PREP ")	\
77 	EM(netfs_sreq_trace_prep_failed,	"PRPFL")	\
78 	EM(netfs_sreq_trace_resubmit_short,	"SHORT")	\
79 	EM(netfs_sreq_trace_retry,		"RETRY")	\
80 	EM(netfs_sreq_trace_submit,		"SUBMT")	\
81 	EM(netfs_sreq_trace_terminated,		"TERM ")	\
82 	EM(netfs_sreq_trace_write,		"WRITE")	\
83 	EM(netfs_sreq_trace_write_skip,		"SKIP ")	\
84 	E_(netfs_sreq_trace_write_term,		"WTERM")
85 
86 #define netfs_failures							\
87 	EM(netfs_fail_check_write_begin,	"check-write-begin")	\
88 	EM(netfs_fail_copy_to_cache,		"copy-to-cache")	\
89 	EM(netfs_fail_dio_read_short,		"dio-read-short")	\
90 	EM(netfs_fail_dio_read_zero,		"dio-read-zero")	\
91 	EM(netfs_fail_read,			"read")			\
92 	EM(netfs_fail_short_read,		"short-read")		\
93 	EM(netfs_fail_prepare_write,		"prep-write")		\
94 	E_(netfs_fail_write,			"write")
95 
96 #define netfs_rreq_ref_traces					\
97 	EM(netfs_rreq_trace_get_for_outstanding,"GET OUTSTND")	\
98 	EM(netfs_rreq_trace_get_subreq,		"GET SUBREQ ")	\
99 	EM(netfs_rreq_trace_get_work,		"GET WORK   ")	\
100 	EM(netfs_rreq_trace_put_complete,	"PUT COMPLT ")	\
101 	EM(netfs_rreq_trace_put_discard,	"PUT DISCARD")	\
102 	EM(netfs_rreq_trace_put_failed,		"PUT FAILED ")	\
103 	EM(netfs_rreq_trace_put_no_submit,	"PUT NO-SUBM")	\
104 	EM(netfs_rreq_trace_put_return,		"PUT RETURN ")	\
105 	EM(netfs_rreq_trace_put_subreq,		"PUT SUBREQ ")	\
106 	EM(netfs_rreq_trace_put_work,		"PUT WORK   ")	\
107 	EM(netfs_rreq_trace_put_work_complete,	"PUT WORK CP")	\
108 	EM(netfs_rreq_trace_put_work_nq,	"PUT WORK NQ")	\
109 	EM(netfs_rreq_trace_see_work,		"SEE WORK   ")	\
110 	E_(netfs_rreq_trace_new,		"NEW        ")
111 
112 #define netfs_sreq_ref_traces					\
113 	EM(netfs_sreq_trace_get_copy_to_cache,	"GET COPY2C ")	\
114 	EM(netfs_sreq_trace_get_resubmit,	"GET RESUBMIT")	\
115 	EM(netfs_sreq_trace_get_submit,		"GET SUBMIT")	\
116 	EM(netfs_sreq_trace_get_short_read,	"GET SHORTRD")	\
117 	EM(netfs_sreq_trace_new,		"NEW        ")	\
118 	EM(netfs_sreq_trace_put_cancel,		"PUT CANCEL ")	\
119 	EM(netfs_sreq_trace_put_clear,		"PUT CLEAR  ")	\
120 	EM(netfs_sreq_trace_put_discard,	"PUT DISCARD")	\
121 	EM(netfs_sreq_trace_put_done,		"PUT DONE   ")	\
122 	EM(netfs_sreq_trace_put_failed,		"PUT FAILED ")	\
123 	EM(netfs_sreq_trace_put_merged,		"PUT MERGED ")	\
124 	EM(netfs_sreq_trace_put_no_copy,	"PUT NO COPY")	\
125 	EM(netfs_sreq_trace_put_oom,		"PUT OOM    ")	\
126 	EM(netfs_sreq_trace_put_wip,		"PUT WIP    ")	\
127 	EM(netfs_sreq_trace_put_work,		"PUT WORK   ")	\
128 	E_(netfs_sreq_trace_put_terminated,	"PUT TERM   ")
129 
130 #define netfs_folio_traces					\
131 	/* The first few correspond to enum netfs_how_to_modify */	\
132 	EM(netfs_folio_is_uptodate,		"mod-uptodate")	\
133 	EM(netfs_just_prefetch,			"mod-prefetch")	\
134 	EM(netfs_whole_folio_modify,		"mod-whole-f")	\
135 	EM(netfs_modify_and_clear,		"mod-n-clear")	\
136 	EM(netfs_streaming_write,		"mod-streamw")	\
137 	EM(netfs_streaming_write_cont,		"mod-streamw+")	\
138 	EM(netfs_flush_content,			"flush")	\
139 	EM(netfs_streaming_filled_page,		"mod-streamw-f") \
140 	EM(netfs_streaming_cont_filled_page,	"mod-streamw-f+") \
141 	/* The rest are for writeback */			\
142 	EM(netfs_folio_trace_cancel_copy,	"cancel-copy")	\
143 	EM(netfs_folio_trace_clear,		"clear")	\
144 	EM(netfs_folio_trace_clear_cc,		"clear-cc")	\
145 	EM(netfs_folio_trace_clear_g,		"clear-g")	\
146 	EM(netfs_folio_trace_clear_s,		"clear-s")	\
147 	EM(netfs_folio_trace_copy_to_cache,	"mark-copy")	\
148 	EM(netfs_folio_trace_filled_gaps,	"filled-gaps")	\
149 	EM(netfs_folio_trace_kill,		"kill")		\
150 	EM(netfs_folio_trace_kill_cc,		"kill-cc")	\
151 	EM(netfs_folio_trace_kill_g,		"kill-g")	\
152 	EM(netfs_folio_trace_kill_s,		"kill-s")	\
153 	EM(netfs_folio_trace_mkwrite,		"mkwrite")	\
154 	EM(netfs_folio_trace_mkwrite_plus,	"mkwrite+")	\
155 	EM(netfs_folio_trace_not_under_wback,	"!wback")	\
156 	EM(netfs_folio_trace_read_gaps,		"read-gaps")	\
157 	EM(netfs_folio_trace_redirtied,		"redirtied")	\
158 	EM(netfs_folio_trace_store,		"store")	\
159 	EM(netfs_folio_trace_store_copy,	"store-copy")	\
160 	EM(netfs_folio_trace_store_plus,	"store+")	\
161 	EM(netfs_folio_trace_wthru,		"wthru")	\
162 	E_(netfs_folio_trace_wthru_plus,	"wthru+")
163 
164 #define netfs_collect_contig_traces				\
165 	EM(netfs_contig_trace_collect,		"Collect")	\
166 	EM(netfs_contig_trace_jump,		"-->JUMP-->")	\
167 	E_(netfs_contig_trace_unlock,		"Unlock")
168 
169 #ifndef __NETFS_DECLARE_TRACE_ENUMS_ONCE_ONLY
170 #define __NETFS_DECLARE_TRACE_ENUMS_ONCE_ONLY
171 
172 #undef EM
173 #undef E_
174 #define EM(a, b) a,
175 #define E_(a, b) a
176 
177 enum netfs_read_trace { netfs_read_traces } __mode(byte);
178 enum netfs_write_trace { netfs_write_traces } __mode(byte);
179 enum netfs_rreq_trace { netfs_rreq_traces } __mode(byte);
180 enum netfs_sreq_trace { netfs_sreq_traces } __mode(byte);
181 enum netfs_failure { netfs_failures } __mode(byte);
182 enum netfs_rreq_ref_trace { netfs_rreq_ref_traces } __mode(byte);
183 enum netfs_sreq_ref_trace { netfs_sreq_ref_traces } __mode(byte);
184 enum netfs_folio_trace { netfs_folio_traces } __mode(byte);
185 enum netfs_collect_contig_trace { netfs_collect_contig_traces } __mode(byte);
186 
187 #endif
188 
189 /*
190  * Export enum symbols via userspace.
191  */
192 #undef EM
193 #undef E_
194 #define EM(a, b) TRACE_DEFINE_ENUM(a);
195 #define E_(a, b) TRACE_DEFINE_ENUM(a);
196 
197 netfs_read_traces;
198 netfs_write_traces;
199 netfs_rreq_origins;
200 netfs_rreq_traces;
201 netfs_sreq_sources;
202 netfs_sreq_traces;
203 netfs_failures;
204 netfs_rreq_ref_traces;
205 netfs_sreq_ref_traces;
206 netfs_folio_traces;
207 netfs_collect_contig_traces;
208 
209 /*
210  * Now redefine the EM() and E_() macros to map the enums to the strings that
211  * will be printed in the output.
212  */
213 #undef EM
214 #undef E_
215 #define EM(a, b)	{ a, b },
216 #define E_(a, b)	{ a, b }
217 
218 TRACE_EVENT(netfs_read,
219 	    TP_PROTO(struct netfs_io_request *rreq,
220 		     loff_t start, size_t len,
221 		     enum netfs_read_trace what),
222 
223 	    TP_ARGS(rreq, start, len, what),
224 
225 	    TP_STRUCT__entry(
226 		    __field(unsigned int,		rreq		)
227 		    __field(unsigned int,		cookie		)
228 		    __field(loff_t,			start		)
229 		    __field(size_t,			len		)
230 		    __field(enum netfs_read_trace,	what		)
231 		    __field(unsigned int,		netfs_inode	)
232 			     ),
233 
234 	    TP_fast_assign(
235 		    __entry->rreq	= rreq->debug_id;
236 		    __entry->cookie	= rreq->cache_resources.debug_id;
237 		    __entry->start	= start;
238 		    __entry->len	= len;
239 		    __entry->what	= what;
240 		    __entry->netfs_inode = rreq->inode->i_ino;
241 			   ),
242 
243 	    TP_printk("R=%08x %s c=%08x ni=%x s=%llx %zx",
244 		      __entry->rreq,
245 		      __print_symbolic(__entry->what, netfs_read_traces),
246 		      __entry->cookie,
247 		      __entry->netfs_inode,
248 		      __entry->start, __entry->len)
249 	    );
250 
251 TRACE_EVENT(netfs_rreq,
252 	    TP_PROTO(struct netfs_io_request *rreq,
253 		     enum netfs_rreq_trace what),
254 
255 	    TP_ARGS(rreq, what),
256 
257 	    TP_STRUCT__entry(
258 		    __field(unsigned int,		rreq		)
259 		    __field(unsigned int,		flags		)
260 		    __field(enum netfs_io_origin,	origin		)
261 		    __field(enum netfs_rreq_trace,	what		)
262 			     ),
263 
264 	    TP_fast_assign(
265 		    __entry->rreq	= rreq->debug_id;
266 		    __entry->flags	= rreq->flags;
267 		    __entry->origin	= rreq->origin;
268 		    __entry->what	= what;
269 			   ),
270 
271 	    TP_printk("R=%08x %s %s f=%02x",
272 		      __entry->rreq,
273 		      __print_symbolic(__entry->origin, netfs_rreq_origins),
274 		      __print_symbolic(__entry->what, netfs_rreq_traces),
275 		      __entry->flags)
276 	    );
277 
278 TRACE_EVENT(netfs_sreq,
279 	    TP_PROTO(struct netfs_io_subrequest *sreq,
280 		     enum netfs_sreq_trace what),
281 
282 	    TP_ARGS(sreq, what),
283 
284 	    TP_STRUCT__entry(
285 		    __field(unsigned int,		rreq		)
286 		    __field(unsigned short,		index		)
287 		    __field(short,			error		)
288 		    __field(unsigned short,		flags		)
289 		    __field(enum netfs_io_source,	source		)
290 		    __field(enum netfs_sreq_trace,	what		)
291 		    __field(size_t,			len		)
292 		    __field(size_t,			transferred	)
293 		    __field(loff_t,			start		)
294 			     ),
295 
296 	    TP_fast_assign(
297 		    __entry->rreq	= sreq->rreq->debug_id;
298 		    __entry->index	= sreq->debug_index;
299 		    __entry->error	= sreq->error;
300 		    __entry->flags	= sreq->flags;
301 		    __entry->source	= sreq->source;
302 		    __entry->what	= what;
303 		    __entry->len	= sreq->len;
304 		    __entry->transferred = sreq->transferred;
305 		    __entry->start	= sreq->start;
306 			   ),
307 
308 	    TP_printk("R=%08x[%x] %s %s f=%02x s=%llx %zx/%zx e=%d",
309 		      __entry->rreq, __entry->index,
310 		      __print_symbolic(__entry->source, netfs_sreq_sources),
311 		      __print_symbolic(__entry->what, netfs_sreq_traces),
312 		      __entry->flags,
313 		      __entry->start, __entry->transferred, __entry->len,
314 		      __entry->error)
315 	    );
316 
317 TRACE_EVENT(netfs_failure,
318 	    TP_PROTO(struct netfs_io_request *rreq,
319 		     struct netfs_io_subrequest *sreq,
320 		     int error, enum netfs_failure what),
321 
322 	    TP_ARGS(rreq, sreq, error, what),
323 
324 	    TP_STRUCT__entry(
325 		    __field(unsigned int,		rreq		)
326 		    __field(short,			index		)
327 		    __field(short,			error		)
328 		    __field(unsigned short,		flags		)
329 		    __field(enum netfs_io_source,	source		)
330 		    __field(enum netfs_failure,		what		)
331 		    __field(size_t,			len		)
332 		    __field(size_t,			transferred	)
333 		    __field(loff_t,			start		)
334 			     ),
335 
336 	    TP_fast_assign(
337 		    __entry->rreq	= rreq->debug_id;
338 		    __entry->index	= sreq ? sreq->debug_index : -1;
339 		    __entry->error	= error;
340 		    __entry->flags	= sreq ? sreq->flags : 0;
341 		    __entry->source	= sreq ? sreq->source : NETFS_INVALID_READ;
342 		    __entry->what	= what;
343 		    __entry->len	= sreq ? sreq->len : rreq->len;
344 		    __entry->transferred = sreq ? sreq->transferred : 0;
345 		    __entry->start	= sreq ? sreq->start : 0;
346 			   ),
347 
348 	    TP_printk("R=%08x[%x] %s f=%02x s=%llx %zx/%zx %s e=%d",
349 		      __entry->rreq, __entry->index,
350 		      __print_symbolic(__entry->source, netfs_sreq_sources),
351 		      __entry->flags,
352 		      __entry->start, __entry->transferred, __entry->len,
353 		      __print_symbolic(__entry->what, netfs_failures),
354 		      __entry->error)
355 	    );
356 
357 TRACE_EVENT(netfs_rreq_ref,
358 	    TP_PROTO(unsigned int rreq_debug_id, int ref,
359 		     enum netfs_rreq_ref_trace what),
360 
361 	    TP_ARGS(rreq_debug_id, ref, what),
362 
363 	    TP_STRUCT__entry(
364 		    __field(unsigned int,		rreq		)
365 		    __field(int,			ref		)
366 		    __field(enum netfs_rreq_ref_trace,	what		)
367 			     ),
368 
369 	    TP_fast_assign(
370 		    __entry->rreq	= rreq_debug_id;
371 		    __entry->ref	= ref;
372 		    __entry->what	= what;
373 			   ),
374 
375 	    TP_printk("R=%08x %s r=%u",
376 		      __entry->rreq,
377 		      __print_symbolic(__entry->what, netfs_rreq_ref_traces),
378 		      __entry->ref)
379 	    );
380 
381 TRACE_EVENT(netfs_sreq_ref,
382 	    TP_PROTO(unsigned int rreq_debug_id, unsigned int subreq_debug_index,
383 		     int ref, enum netfs_sreq_ref_trace what),
384 
385 	    TP_ARGS(rreq_debug_id, subreq_debug_index, ref, what),
386 
387 	    TP_STRUCT__entry(
388 		    __field(unsigned int,		rreq		)
389 		    __field(unsigned int,		subreq		)
390 		    __field(int,			ref		)
391 		    __field(enum netfs_sreq_ref_trace,	what		)
392 			     ),
393 
394 	    TP_fast_assign(
395 		    __entry->rreq	= rreq_debug_id;
396 		    __entry->subreq	= subreq_debug_index;
397 		    __entry->ref	= ref;
398 		    __entry->what	= what;
399 			   ),
400 
401 	    TP_printk("R=%08x[%x] %s r=%u",
402 		      __entry->rreq,
403 		      __entry->subreq,
404 		      __print_symbolic(__entry->what, netfs_sreq_ref_traces),
405 		      __entry->ref)
406 	    );
407 
408 TRACE_EVENT(netfs_folio,
409 	    TP_PROTO(struct folio *folio, enum netfs_folio_trace why),
410 
411 	    TP_ARGS(folio, why),
412 
413 	    TP_STRUCT__entry(
414 		    __field(ino_t,			ino)
415 		    __field(pgoff_t,			index)
416 		    __field(unsigned int,		nr)
417 		    __field(enum netfs_folio_trace,	why)
418 			     ),
419 
420 	    TP_fast_assign(
421 		    __entry->ino = folio->mapping->host->i_ino;
422 		    __entry->why = why;
423 		    __entry->index = folio_index(folio);
424 		    __entry->nr = folio_nr_pages(folio);
425 			   ),
426 
427 	    TP_printk("i=%05lx ix=%05lx-%05lx %s",
428 		      __entry->ino, __entry->index, __entry->index + __entry->nr - 1,
429 		      __print_symbolic(__entry->why, netfs_folio_traces))
430 	    );
431 
432 TRACE_EVENT(netfs_write_iter,
433 	    TP_PROTO(const struct kiocb *iocb, const struct iov_iter *from),
434 
435 	    TP_ARGS(iocb, from),
436 
437 	    TP_STRUCT__entry(
438 		    __field(unsigned long long,		start		)
439 		    __field(size_t,			len		)
440 		    __field(unsigned int,		flags		)
441 		    __field(unsigned int,		ino		)
442 			     ),
443 
444 	    TP_fast_assign(
445 		    __entry->start	= iocb->ki_pos;
446 		    __entry->len	= iov_iter_count(from);
447 		    __entry->ino	= iocb->ki_filp->f_inode->i_ino;
448 		    __entry->flags	= iocb->ki_flags;
449 			   ),
450 
451 	    TP_printk("WRITE-ITER i=%x s=%llx l=%zx f=%x",
452 		      __entry->ino, __entry->start, __entry->len, __entry->flags)
453 	    );
454 
455 TRACE_EVENT(netfs_write,
456 	    TP_PROTO(const struct netfs_io_request *wreq,
457 		     enum netfs_write_trace what),
458 
459 	    TP_ARGS(wreq, what),
460 
461 	    TP_STRUCT__entry(
462 		    __field(unsigned int,		wreq		)
463 		    __field(unsigned int,		cookie		)
464 		    __field(unsigned int,		ino		)
465 		    __field(enum netfs_write_trace,	what		)
466 		    __field(unsigned long long,		start		)
467 		    __field(unsigned long long,		len		)
468 			     ),
469 
470 	    TP_fast_assign(
471 		    struct netfs_inode *__ctx = netfs_inode(wreq->inode);
472 		    struct fscache_cookie *__cookie = netfs_i_cookie(__ctx);
473 		    __entry->wreq	= wreq->debug_id;
474 		    __entry->cookie	= __cookie ? __cookie->debug_id : 0;
475 		    __entry->ino	= wreq->inode->i_ino;
476 		    __entry->what	= what;
477 		    __entry->start	= wreq->start;
478 		    __entry->len	= wreq->len;
479 			   ),
480 
481 	    TP_printk("R=%08x %s c=%08x i=%x by=%llx-%llx",
482 		      __entry->wreq,
483 		      __print_symbolic(__entry->what, netfs_write_traces),
484 		      __entry->cookie,
485 		      __entry->ino,
486 		      __entry->start, __entry->start + __entry->len - 1)
487 	    );
488 
489 TRACE_EVENT(netfs_collect,
490 	    TP_PROTO(const struct netfs_io_request *wreq),
491 
492 	    TP_ARGS(wreq),
493 
494 	    TP_STRUCT__entry(
495 		    __field(unsigned int,		wreq		)
496 		    __field(unsigned int,		len		)
497 		    __field(unsigned long long,		transferred	)
498 		    __field(unsigned long long,		start		)
499 			     ),
500 
501 	    TP_fast_assign(
502 		    __entry->wreq	= wreq->debug_id;
503 		    __entry->start	= wreq->start;
504 		    __entry->len	= wreq->len;
505 		    __entry->transferred = wreq->transferred;
506 			   ),
507 
508 	    TP_printk("R=%08x s=%llx-%llx",
509 		      __entry->wreq,
510 		      __entry->start + __entry->transferred,
511 		      __entry->start + __entry->len)
512 	    );
513 
514 TRACE_EVENT(netfs_collect_contig,
515 	    TP_PROTO(const struct netfs_io_request *wreq, unsigned long long to,
516 		     enum netfs_collect_contig_trace type),
517 
518 	    TP_ARGS(wreq, to, type),
519 
520 	    TP_STRUCT__entry(
521 		    __field(unsigned int,		wreq)
522 		    __field(enum netfs_collect_contig_trace, type)
523 		    __field(unsigned long long,		contiguity)
524 		    __field(unsigned long long,		to)
525 			     ),
526 
527 	    TP_fast_assign(
528 		    __entry->wreq	= wreq->debug_id;
529 		    __entry->type	= type;
530 		    __entry->contiguity	= wreq->contiguity;
531 		    __entry->to		= to;
532 			   ),
533 
534 	    TP_printk("R=%08x %llx -> %llx %s",
535 		      __entry->wreq,
536 		      __entry->contiguity,
537 		      __entry->to,
538 		      __print_symbolic(__entry->type, netfs_collect_contig_traces))
539 	    );
540 
541 TRACE_EVENT(netfs_collect_sreq,
542 	    TP_PROTO(const struct netfs_io_request *wreq,
543 		     const struct netfs_io_subrequest *subreq),
544 
545 	    TP_ARGS(wreq, subreq),
546 
547 	    TP_STRUCT__entry(
548 		    __field(unsigned int,		wreq		)
549 		    __field(unsigned int,		subreq		)
550 		    __field(unsigned int,		stream		)
551 		    __field(unsigned int,		len		)
552 		    __field(unsigned int,		transferred	)
553 		    __field(unsigned long long,		start		)
554 			     ),
555 
556 	    TP_fast_assign(
557 		    __entry->wreq	= wreq->debug_id;
558 		    __entry->subreq	= subreq->debug_index;
559 		    __entry->stream	= subreq->stream_nr;
560 		    __entry->start	= subreq->start;
561 		    __entry->len	= subreq->len;
562 		    __entry->transferred = subreq->transferred;
563 			   ),
564 
565 	    TP_printk("R=%08x[%u:%02x] s=%llx t=%x/%x",
566 		      __entry->wreq, __entry->stream, __entry->subreq,
567 		      __entry->start, __entry->transferred, __entry->len)
568 	    );
569 
570 TRACE_EVENT(netfs_collect_folio,
571 	    TP_PROTO(const struct netfs_io_request *wreq,
572 		     const struct folio *folio,
573 		     unsigned long long fend,
574 		     unsigned long long collected_to),
575 
576 	    TP_ARGS(wreq, folio, fend, collected_to),
577 
578 	    TP_STRUCT__entry(
579 		    __field(unsigned int,	wreq		)
580 		    __field(unsigned long,	index		)
581 		    __field(unsigned long long,	fend		)
582 		    __field(unsigned long long,	cleaned_to	)
583 		    __field(unsigned long long,	collected_to	)
584 			     ),
585 
586 	    TP_fast_assign(
587 		    __entry->wreq	= wreq->debug_id;
588 		    __entry->index	= folio->index;
589 		    __entry->fend	= fend;
590 		    __entry->cleaned_to	= wreq->cleaned_to;
591 		    __entry->collected_to = collected_to;
592 			   ),
593 
594 	    TP_printk("R=%08x ix=%05lx r=%llx-%llx t=%llx/%llx",
595 		      __entry->wreq, __entry->index,
596 		      (unsigned long long)__entry->index * PAGE_SIZE, __entry->fend,
597 		      __entry->cleaned_to, __entry->collected_to)
598 	    );
599 
600 TRACE_EVENT(netfs_collect_state,
601 	    TP_PROTO(const struct netfs_io_request *wreq,
602 		     unsigned long long collected_to,
603 		     unsigned int notes),
604 
605 	    TP_ARGS(wreq, collected_to, notes),
606 
607 	    TP_STRUCT__entry(
608 		    __field(unsigned int,	wreq		)
609 		    __field(unsigned int,	notes		)
610 		    __field(unsigned long long,	collected_to	)
611 		    __field(unsigned long long,	cleaned_to	)
612 		    __field(unsigned long long,	contiguity	)
613 			     ),
614 
615 	    TP_fast_assign(
616 		    __entry->wreq	= wreq->debug_id;
617 		    __entry->notes	= notes;
618 		    __entry->collected_to = collected_to;
619 		    __entry->cleaned_to	= wreq->cleaned_to;
620 		    __entry->contiguity = wreq->contiguity;
621 			   ),
622 
623 	    TP_printk("R=%08x cto=%llx fto=%llx ctg=%llx n=%x",
624 		      __entry->wreq, __entry->collected_to,
625 		      __entry->cleaned_to, __entry->contiguity,
626 		      __entry->notes)
627 	    );
628 
629 TRACE_EVENT(netfs_collect_gap,
630 	    TP_PROTO(const struct netfs_io_request *wreq,
631 		     const struct netfs_io_stream *stream,
632 		     unsigned long long jump_to, char type),
633 
634 	    TP_ARGS(wreq, stream, jump_to, type),
635 
636 	    TP_STRUCT__entry(
637 		    __field(unsigned int,	wreq)
638 		    __field(unsigned char,	stream)
639 		    __field(unsigned char,	type)
640 		    __field(unsigned long long,	from)
641 		    __field(unsigned long long,	to)
642 			     ),
643 
644 	    TP_fast_assign(
645 		    __entry->wreq	= wreq->debug_id;
646 		    __entry->stream	= stream->stream_nr;
647 		    __entry->from	= stream->collected_to;
648 		    __entry->to		= jump_to;
649 		    __entry->type	= type;
650 			   ),
651 
652 	    TP_printk("R=%08x[%x:] %llx->%llx %c",
653 		      __entry->wreq, __entry->stream,
654 		      __entry->from, __entry->to, __entry->type)
655 	    );
656 
657 TRACE_EVENT(netfs_collect_stream,
658 	    TP_PROTO(const struct netfs_io_request *wreq,
659 		     const struct netfs_io_stream *stream),
660 
661 	    TP_ARGS(wreq, stream),
662 
663 	    TP_STRUCT__entry(
664 		    __field(unsigned int,	wreq)
665 		    __field(unsigned char,	stream)
666 		    __field(unsigned long long,	collected_to)
667 		    __field(unsigned long long,	front)
668 			     ),
669 
670 	    TP_fast_assign(
671 		    __entry->wreq	= wreq->debug_id;
672 		    __entry->stream	= stream->stream_nr;
673 		    __entry->collected_to = stream->collected_to;
674 		    __entry->front	= stream->front ? stream->front->start : UINT_MAX;
675 			   ),
676 
677 	    TP_printk("R=%08x[%x:] cto=%llx frn=%llx",
678 		      __entry->wreq, __entry->stream,
679 		      __entry->collected_to, __entry->front)
680 	    );
681 
682 #undef EM
683 #undef E_
684 #endif /* _TRACE_NETFS_H */
685 
686 /* This part must be outside protection */
687 #include <trace/define_trace.h>
688