xref: /openbmc/linux/include/trace/events/writeback.h (revision 92a2c6b2)
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM writeback
3 
4 #if !defined(_TRACE_WRITEBACK_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_WRITEBACK_H
6 
7 #include <linux/tracepoint.h>
8 #include <linux/backing-dev.h>
9 #include <linux/writeback.h>
10 
11 #define show_inode_state(state)					\
12 	__print_flags(state, "|",				\
13 		{I_DIRTY_SYNC,		"I_DIRTY_SYNC"},	\
14 		{I_DIRTY_DATASYNC,	"I_DIRTY_DATASYNC"},	\
15 		{I_DIRTY_PAGES,		"I_DIRTY_PAGES"},	\
16 		{I_NEW,			"I_NEW"},		\
17 		{I_WILL_FREE,		"I_WILL_FREE"},		\
18 		{I_FREEING,		"I_FREEING"},		\
19 		{I_CLEAR,		"I_CLEAR"},		\
20 		{I_SYNC,		"I_SYNC"},		\
21 		{I_DIRTY_TIME,		"I_DIRTY_TIME"},	\
22 		{I_DIRTY_TIME_EXPIRED,	"I_DIRTY_TIME_EXPIRED"}, \
23 		{I_REFERENCED,		"I_REFERENCED"}		\
24 	)
25 
26 #define WB_WORK_REASON							\
27 		{WB_REASON_BACKGROUND,		"background"},		\
28 		{WB_REASON_TRY_TO_FREE_PAGES,	"try_to_free_pages"},	\
29 		{WB_REASON_SYNC,		"sync"},		\
30 		{WB_REASON_PERIODIC,		"periodic"},		\
31 		{WB_REASON_LAPTOP_TIMER,	"laptop_timer"},	\
32 		{WB_REASON_FREE_MORE_MEM,	"free_more_memory"},	\
33 		{WB_REASON_FS_FREE_SPACE,	"fs_free_space"},	\
34 		{WB_REASON_FORKER_THREAD,	"forker_thread"}
35 
36 struct wb_writeback_work;
37 
38 TRACE_EVENT(writeback_dirty_page,
39 
40 	TP_PROTO(struct page *page, struct address_space *mapping),
41 
42 	TP_ARGS(page, mapping),
43 
44 	TP_STRUCT__entry (
45 		__array(char, name, 32)
46 		__field(unsigned long, ino)
47 		__field(pgoff_t, index)
48 	),
49 
50 	TP_fast_assign(
51 		strncpy(__entry->name,
52 			mapping ? dev_name(inode_to_bdi(mapping->host)->dev) : "(unknown)", 32);
53 		__entry->ino = mapping ? mapping->host->i_ino : 0;
54 		__entry->index = page->index;
55 	),
56 
57 	TP_printk("bdi %s: ino=%lu index=%lu",
58 		__entry->name,
59 		__entry->ino,
60 		__entry->index
61 	)
62 );
63 
64 DECLARE_EVENT_CLASS(writeback_dirty_inode_template,
65 
66 	TP_PROTO(struct inode *inode, int flags),
67 
68 	TP_ARGS(inode, flags),
69 
70 	TP_STRUCT__entry (
71 		__array(char, name, 32)
72 		__field(unsigned long, ino)
73 		__field(unsigned long, state)
74 		__field(unsigned long, flags)
75 	),
76 
77 	TP_fast_assign(
78 		struct backing_dev_info *bdi = inode_to_bdi(inode);
79 
80 		/* may be called for files on pseudo FSes w/ unregistered bdi */
81 		strncpy(__entry->name,
82 			bdi->dev ? dev_name(bdi->dev) : "(unknown)", 32);
83 		__entry->ino		= inode->i_ino;
84 		__entry->state		= inode->i_state;
85 		__entry->flags		= flags;
86 	),
87 
88 	TP_printk("bdi %s: ino=%lu state=%s flags=%s",
89 		__entry->name,
90 		__entry->ino,
91 		show_inode_state(__entry->state),
92 		show_inode_state(__entry->flags)
93 	)
94 );
95 
96 DEFINE_EVENT(writeback_dirty_inode_template, writeback_mark_inode_dirty,
97 
98 	TP_PROTO(struct inode *inode, int flags),
99 
100 	TP_ARGS(inode, flags)
101 );
102 
103 DEFINE_EVENT(writeback_dirty_inode_template, writeback_dirty_inode_start,
104 
105 	TP_PROTO(struct inode *inode, int flags),
106 
107 	TP_ARGS(inode, flags)
108 );
109 
110 DEFINE_EVENT(writeback_dirty_inode_template, writeback_dirty_inode,
111 
112 	TP_PROTO(struct inode *inode, int flags),
113 
114 	TP_ARGS(inode, flags)
115 );
116 
117 DECLARE_EVENT_CLASS(writeback_write_inode_template,
118 
119 	TP_PROTO(struct inode *inode, struct writeback_control *wbc),
120 
121 	TP_ARGS(inode, wbc),
122 
123 	TP_STRUCT__entry (
124 		__array(char, name, 32)
125 		__field(unsigned long, ino)
126 		__field(int, sync_mode)
127 	),
128 
129 	TP_fast_assign(
130 		strncpy(__entry->name,
131 			dev_name(inode_to_bdi(inode)->dev), 32);
132 		__entry->ino		= inode->i_ino;
133 		__entry->sync_mode	= wbc->sync_mode;
134 	),
135 
136 	TP_printk("bdi %s: ino=%lu sync_mode=%d",
137 		__entry->name,
138 		__entry->ino,
139 		__entry->sync_mode
140 	)
141 );
142 
143 DEFINE_EVENT(writeback_write_inode_template, writeback_write_inode_start,
144 
145 	TP_PROTO(struct inode *inode, struct writeback_control *wbc),
146 
147 	TP_ARGS(inode, wbc)
148 );
149 
150 DEFINE_EVENT(writeback_write_inode_template, writeback_write_inode,
151 
152 	TP_PROTO(struct inode *inode, struct writeback_control *wbc),
153 
154 	TP_ARGS(inode, wbc)
155 );
156 
157 DECLARE_EVENT_CLASS(writeback_work_class,
158 	TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work),
159 	TP_ARGS(bdi, work),
160 	TP_STRUCT__entry(
161 		__array(char, name, 32)
162 		__field(long, nr_pages)
163 		__field(dev_t, sb_dev)
164 		__field(int, sync_mode)
165 		__field(int, for_kupdate)
166 		__field(int, range_cyclic)
167 		__field(int, for_background)
168 		__field(int, reason)
169 	),
170 	TP_fast_assign(
171 		strncpy(__entry->name,
172 			bdi->dev ? dev_name(bdi->dev) : "(unknown)", 32);
173 		__entry->nr_pages = work->nr_pages;
174 		__entry->sb_dev = work->sb ? work->sb->s_dev : 0;
175 		__entry->sync_mode = work->sync_mode;
176 		__entry->for_kupdate = work->for_kupdate;
177 		__entry->range_cyclic = work->range_cyclic;
178 		__entry->for_background	= work->for_background;
179 		__entry->reason = work->reason;
180 	),
181 	TP_printk("bdi %s: sb_dev %d:%d nr_pages=%ld sync_mode=%d "
182 		  "kupdate=%d range_cyclic=%d background=%d reason=%s",
183 		  __entry->name,
184 		  MAJOR(__entry->sb_dev), MINOR(__entry->sb_dev),
185 		  __entry->nr_pages,
186 		  __entry->sync_mode,
187 		  __entry->for_kupdate,
188 		  __entry->range_cyclic,
189 		  __entry->for_background,
190 		  __print_symbolic(__entry->reason, WB_WORK_REASON)
191 	)
192 );
193 #define DEFINE_WRITEBACK_WORK_EVENT(name) \
194 DEFINE_EVENT(writeback_work_class, name, \
195 	TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), \
196 	TP_ARGS(bdi, work))
197 DEFINE_WRITEBACK_WORK_EVENT(writeback_queue);
198 DEFINE_WRITEBACK_WORK_EVENT(writeback_exec);
199 DEFINE_WRITEBACK_WORK_EVENT(writeback_start);
200 DEFINE_WRITEBACK_WORK_EVENT(writeback_written);
201 DEFINE_WRITEBACK_WORK_EVENT(writeback_wait);
202 
203 TRACE_EVENT(writeback_pages_written,
204 	TP_PROTO(long pages_written),
205 	TP_ARGS(pages_written),
206 	TP_STRUCT__entry(
207 		__field(long,		pages)
208 	),
209 	TP_fast_assign(
210 		__entry->pages		= pages_written;
211 	),
212 	TP_printk("%ld", __entry->pages)
213 );
214 
215 DECLARE_EVENT_CLASS(writeback_class,
216 	TP_PROTO(struct backing_dev_info *bdi),
217 	TP_ARGS(bdi),
218 	TP_STRUCT__entry(
219 		__array(char, name, 32)
220 	),
221 	TP_fast_assign(
222 		strncpy(__entry->name, dev_name(bdi->dev), 32);
223 	),
224 	TP_printk("bdi %s",
225 		  __entry->name
226 	)
227 );
228 #define DEFINE_WRITEBACK_EVENT(name) \
229 DEFINE_EVENT(writeback_class, name, \
230 	TP_PROTO(struct backing_dev_info *bdi), \
231 	TP_ARGS(bdi))
232 
233 DEFINE_WRITEBACK_EVENT(writeback_nowork);
234 DEFINE_WRITEBACK_EVENT(writeback_wake_background);
235 DEFINE_WRITEBACK_EVENT(writeback_bdi_register);
236 DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister);
237 
238 DECLARE_EVENT_CLASS(wbc_class,
239 	TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi),
240 	TP_ARGS(wbc, bdi),
241 	TP_STRUCT__entry(
242 		__array(char, name, 32)
243 		__field(long, nr_to_write)
244 		__field(long, pages_skipped)
245 		__field(int, sync_mode)
246 		__field(int, for_kupdate)
247 		__field(int, for_background)
248 		__field(int, for_reclaim)
249 		__field(int, range_cyclic)
250 		__field(long, range_start)
251 		__field(long, range_end)
252 	),
253 
254 	TP_fast_assign(
255 		strncpy(__entry->name, dev_name(bdi->dev), 32);
256 		__entry->nr_to_write	= wbc->nr_to_write;
257 		__entry->pages_skipped	= wbc->pages_skipped;
258 		__entry->sync_mode	= wbc->sync_mode;
259 		__entry->for_kupdate	= wbc->for_kupdate;
260 		__entry->for_background	= wbc->for_background;
261 		__entry->for_reclaim	= wbc->for_reclaim;
262 		__entry->range_cyclic	= wbc->range_cyclic;
263 		__entry->range_start	= (long)wbc->range_start;
264 		__entry->range_end	= (long)wbc->range_end;
265 	),
266 
267 	TP_printk("bdi %s: towrt=%ld skip=%ld mode=%d kupd=%d "
268 		"bgrd=%d reclm=%d cyclic=%d "
269 		"start=0x%lx end=0x%lx",
270 		__entry->name,
271 		__entry->nr_to_write,
272 		__entry->pages_skipped,
273 		__entry->sync_mode,
274 		__entry->for_kupdate,
275 		__entry->for_background,
276 		__entry->for_reclaim,
277 		__entry->range_cyclic,
278 		__entry->range_start,
279 		__entry->range_end)
280 )
281 
282 #define DEFINE_WBC_EVENT(name) \
283 DEFINE_EVENT(wbc_class, name, \
284 	TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), \
285 	TP_ARGS(wbc, bdi))
286 DEFINE_WBC_EVENT(wbc_writepage);
287 
288 TRACE_EVENT(writeback_queue_io,
289 	TP_PROTO(struct bdi_writeback *wb,
290 		 struct wb_writeback_work *work,
291 		 int moved),
292 	TP_ARGS(wb, work, moved),
293 	TP_STRUCT__entry(
294 		__array(char,		name, 32)
295 		__field(unsigned long,	older)
296 		__field(long,		age)
297 		__field(int,		moved)
298 		__field(int,		reason)
299 	),
300 	TP_fast_assign(
301 		unsigned long *older_than_this = work->older_than_this;
302 		strncpy(__entry->name, dev_name(wb->bdi->dev), 32);
303 		__entry->older	= older_than_this ?  *older_than_this : 0;
304 		__entry->age	= older_than_this ?
305 				  (jiffies - *older_than_this) * 1000 / HZ : -1;
306 		__entry->moved	= moved;
307 		__entry->reason	= work->reason;
308 	),
309 	TP_printk("bdi %s: older=%lu age=%ld enqueue=%d reason=%s",
310 		__entry->name,
311 		__entry->older,	/* older_than_this in jiffies */
312 		__entry->age,	/* older_than_this in relative milliseconds */
313 		__entry->moved,
314 		__print_symbolic(__entry->reason, WB_WORK_REASON)
315 	)
316 );
317 
318 TRACE_EVENT(global_dirty_state,
319 
320 	TP_PROTO(unsigned long background_thresh,
321 		 unsigned long dirty_thresh
322 	),
323 
324 	TP_ARGS(background_thresh,
325 		dirty_thresh
326 	),
327 
328 	TP_STRUCT__entry(
329 		__field(unsigned long,	nr_dirty)
330 		__field(unsigned long,	nr_writeback)
331 		__field(unsigned long,	nr_unstable)
332 		__field(unsigned long,	background_thresh)
333 		__field(unsigned long,	dirty_thresh)
334 		__field(unsigned long,	dirty_limit)
335 		__field(unsigned long,	nr_dirtied)
336 		__field(unsigned long,	nr_written)
337 	),
338 
339 	TP_fast_assign(
340 		__entry->nr_dirty	= global_page_state(NR_FILE_DIRTY);
341 		__entry->nr_writeback	= global_page_state(NR_WRITEBACK);
342 		__entry->nr_unstable	= global_page_state(NR_UNSTABLE_NFS);
343 		__entry->nr_dirtied	= global_page_state(NR_DIRTIED);
344 		__entry->nr_written	= global_page_state(NR_WRITTEN);
345 		__entry->background_thresh = background_thresh;
346 		__entry->dirty_thresh	= dirty_thresh;
347 		__entry->dirty_limit = global_dirty_limit;
348 	),
349 
350 	TP_printk("dirty=%lu writeback=%lu unstable=%lu "
351 		  "bg_thresh=%lu thresh=%lu limit=%lu "
352 		  "dirtied=%lu written=%lu",
353 		  __entry->nr_dirty,
354 		  __entry->nr_writeback,
355 		  __entry->nr_unstable,
356 		  __entry->background_thresh,
357 		  __entry->dirty_thresh,
358 		  __entry->dirty_limit,
359 		  __entry->nr_dirtied,
360 		  __entry->nr_written
361 	)
362 );
363 
364 #define KBps(x)			((x) << (PAGE_SHIFT - 10))
365 
366 TRACE_EVENT(bdi_dirty_ratelimit,
367 
368 	TP_PROTO(struct backing_dev_info *bdi,
369 		 unsigned long dirty_rate,
370 		 unsigned long task_ratelimit),
371 
372 	TP_ARGS(bdi, dirty_rate, task_ratelimit),
373 
374 	TP_STRUCT__entry(
375 		__array(char,		bdi, 32)
376 		__field(unsigned long,	write_bw)
377 		__field(unsigned long,	avg_write_bw)
378 		__field(unsigned long,	dirty_rate)
379 		__field(unsigned long,	dirty_ratelimit)
380 		__field(unsigned long,	task_ratelimit)
381 		__field(unsigned long,	balanced_dirty_ratelimit)
382 	),
383 
384 	TP_fast_assign(
385 		strlcpy(__entry->bdi, dev_name(bdi->dev), 32);
386 		__entry->write_bw	= KBps(bdi->write_bandwidth);
387 		__entry->avg_write_bw	= KBps(bdi->avg_write_bandwidth);
388 		__entry->dirty_rate	= KBps(dirty_rate);
389 		__entry->dirty_ratelimit = KBps(bdi->dirty_ratelimit);
390 		__entry->task_ratelimit	= KBps(task_ratelimit);
391 		__entry->balanced_dirty_ratelimit =
392 					  KBps(bdi->balanced_dirty_ratelimit);
393 	),
394 
395 	TP_printk("bdi %s: "
396 		  "write_bw=%lu awrite_bw=%lu dirty_rate=%lu "
397 		  "dirty_ratelimit=%lu task_ratelimit=%lu "
398 		  "balanced_dirty_ratelimit=%lu",
399 		  __entry->bdi,
400 		  __entry->write_bw,		/* write bandwidth */
401 		  __entry->avg_write_bw,	/* avg write bandwidth */
402 		  __entry->dirty_rate,		/* bdi dirty rate */
403 		  __entry->dirty_ratelimit,	/* base ratelimit */
404 		  __entry->task_ratelimit, /* ratelimit with position control */
405 		  __entry->balanced_dirty_ratelimit /* the balanced ratelimit */
406 	)
407 );
408 
409 TRACE_EVENT(balance_dirty_pages,
410 
411 	TP_PROTO(struct backing_dev_info *bdi,
412 		 unsigned long thresh,
413 		 unsigned long bg_thresh,
414 		 unsigned long dirty,
415 		 unsigned long bdi_thresh,
416 		 unsigned long bdi_dirty,
417 		 unsigned long dirty_ratelimit,
418 		 unsigned long task_ratelimit,
419 		 unsigned long dirtied,
420 		 unsigned long period,
421 		 long pause,
422 		 unsigned long start_time),
423 
424 	TP_ARGS(bdi, thresh, bg_thresh, dirty, bdi_thresh, bdi_dirty,
425 		dirty_ratelimit, task_ratelimit,
426 		dirtied, period, pause, start_time),
427 
428 	TP_STRUCT__entry(
429 		__array(	 char,	bdi, 32)
430 		__field(unsigned long,	limit)
431 		__field(unsigned long,	setpoint)
432 		__field(unsigned long,	dirty)
433 		__field(unsigned long,	bdi_setpoint)
434 		__field(unsigned long,	bdi_dirty)
435 		__field(unsigned long,	dirty_ratelimit)
436 		__field(unsigned long,	task_ratelimit)
437 		__field(unsigned int,	dirtied)
438 		__field(unsigned int,	dirtied_pause)
439 		__field(unsigned long,	paused)
440 		__field(	 long,	pause)
441 		__field(unsigned long,	period)
442 		__field(	 long,	think)
443 	),
444 
445 	TP_fast_assign(
446 		unsigned long freerun = (thresh + bg_thresh) / 2;
447 		strlcpy(__entry->bdi, dev_name(bdi->dev), 32);
448 
449 		__entry->limit		= global_dirty_limit;
450 		__entry->setpoint	= (global_dirty_limit + freerun) / 2;
451 		__entry->dirty		= dirty;
452 		__entry->bdi_setpoint	= __entry->setpoint *
453 						bdi_thresh / (thresh + 1);
454 		__entry->bdi_dirty	= bdi_dirty;
455 		__entry->dirty_ratelimit = KBps(dirty_ratelimit);
456 		__entry->task_ratelimit	= KBps(task_ratelimit);
457 		__entry->dirtied	= dirtied;
458 		__entry->dirtied_pause	= current->nr_dirtied_pause;
459 		__entry->think		= current->dirty_paused_when == 0 ? 0 :
460 			 (long)(jiffies - current->dirty_paused_when) * 1000/HZ;
461 		__entry->period		= period * 1000 / HZ;
462 		__entry->pause		= pause * 1000 / HZ;
463 		__entry->paused		= (jiffies - start_time) * 1000 / HZ;
464 	),
465 
466 
467 	TP_printk("bdi %s: "
468 		  "limit=%lu setpoint=%lu dirty=%lu "
469 		  "bdi_setpoint=%lu bdi_dirty=%lu "
470 		  "dirty_ratelimit=%lu task_ratelimit=%lu "
471 		  "dirtied=%u dirtied_pause=%u "
472 		  "paused=%lu pause=%ld period=%lu think=%ld",
473 		  __entry->bdi,
474 		  __entry->limit,
475 		  __entry->setpoint,
476 		  __entry->dirty,
477 		  __entry->bdi_setpoint,
478 		  __entry->bdi_dirty,
479 		  __entry->dirty_ratelimit,
480 		  __entry->task_ratelimit,
481 		  __entry->dirtied,
482 		  __entry->dirtied_pause,
483 		  __entry->paused,	/* ms */
484 		  __entry->pause,	/* ms */
485 		  __entry->period,	/* ms */
486 		  __entry->think	/* ms */
487 	  )
488 );
489 
490 TRACE_EVENT(writeback_sb_inodes_requeue,
491 
492 	TP_PROTO(struct inode *inode),
493 	TP_ARGS(inode),
494 
495 	TP_STRUCT__entry(
496 		__array(char, name, 32)
497 		__field(unsigned long, ino)
498 		__field(unsigned long, state)
499 		__field(unsigned long, dirtied_when)
500 	),
501 
502 	TP_fast_assign(
503 		strncpy(__entry->name,
504 		        dev_name(inode_to_bdi(inode)->dev), 32);
505 		__entry->ino		= inode->i_ino;
506 		__entry->state		= inode->i_state;
507 		__entry->dirtied_when	= inode->dirtied_when;
508 	),
509 
510 	TP_printk("bdi %s: ino=%lu state=%s dirtied_when=%lu age=%lu",
511 		  __entry->name,
512 		  __entry->ino,
513 		  show_inode_state(__entry->state),
514 		  __entry->dirtied_when,
515 		  (jiffies - __entry->dirtied_when) / HZ
516 	)
517 );
518 
519 DECLARE_EVENT_CLASS(writeback_congest_waited_template,
520 
521 	TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed),
522 
523 	TP_ARGS(usec_timeout, usec_delayed),
524 
525 	TP_STRUCT__entry(
526 		__field(	unsigned int,	usec_timeout	)
527 		__field(	unsigned int,	usec_delayed	)
528 	),
529 
530 	TP_fast_assign(
531 		__entry->usec_timeout	= usec_timeout;
532 		__entry->usec_delayed	= usec_delayed;
533 	),
534 
535 	TP_printk("usec_timeout=%u usec_delayed=%u",
536 			__entry->usec_timeout,
537 			__entry->usec_delayed)
538 );
539 
540 DEFINE_EVENT(writeback_congest_waited_template, writeback_congestion_wait,
541 
542 	TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed),
543 
544 	TP_ARGS(usec_timeout, usec_delayed)
545 );
546 
547 DEFINE_EVENT(writeback_congest_waited_template, writeback_wait_iff_congested,
548 
549 	TP_PROTO(unsigned int usec_timeout, unsigned int usec_delayed),
550 
551 	TP_ARGS(usec_timeout, usec_delayed)
552 );
553 
554 DECLARE_EVENT_CLASS(writeback_single_inode_template,
555 
556 	TP_PROTO(struct inode *inode,
557 		 struct writeback_control *wbc,
558 		 unsigned long nr_to_write
559 	),
560 
561 	TP_ARGS(inode, wbc, nr_to_write),
562 
563 	TP_STRUCT__entry(
564 		__array(char, name, 32)
565 		__field(unsigned long, ino)
566 		__field(unsigned long, state)
567 		__field(unsigned long, dirtied_when)
568 		__field(unsigned long, writeback_index)
569 		__field(long, nr_to_write)
570 		__field(unsigned long, wrote)
571 	),
572 
573 	TP_fast_assign(
574 		strncpy(__entry->name,
575 			dev_name(inode_to_bdi(inode)->dev), 32);
576 		__entry->ino		= inode->i_ino;
577 		__entry->state		= inode->i_state;
578 		__entry->dirtied_when	= inode->dirtied_when;
579 		__entry->writeback_index = inode->i_mapping->writeback_index;
580 		__entry->nr_to_write	= nr_to_write;
581 		__entry->wrote		= nr_to_write - wbc->nr_to_write;
582 	),
583 
584 	TP_printk("bdi %s: ino=%lu state=%s dirtied_when=%lu age=%lu "
585 		  "index=%lu to_write=%ld wrote=%lu",
586 		  __entry->name,
587 		  __entry->ino,
588 		  show_inode_state(__entry->state),
589 		  __entry->dirtied_when,
590 		  (jiffies - __entry->dirtied_when) / HZ,
591 		  __entry->writeback_index,
592 		  __entry->nr_to_write,
593 		  __entry->wrote
594 	)
595 );
596 
597 DEFINE_EVENT(writeback_single_inode_template, writeback_single_inode_start,
598 	TP_PROTO(struct inode *inode,
599 		 struct writeback_control *wbc,
600 		 unsigned long nr_to_write),
601 	TP_ARGS(inode, wbc, nr_to_write)
602 );
603 
604 DEFINE_EVENT(writeback_single_inode_template, writeback_single_inode,
605 	TP_PROTO(struct inode *inode,
606 		 struct writeback_control *wbc,
607 		 unsigned long nr_to_write),
608 	TP_ARGS(inode, wbc, nr_to_write)
609 );
610 
611 DECLARE_EVENT_CLASS(writeback_lazytime_template,
612 	TP_PROTO(struct inode *inode),
613 
614 	TP_ARGS(inode),
615 
616 	TP_STRUCT__entry(
617 		__field(	dev_t,	dev			)
618 		__field(unsigned long,	ino			)
619 		__field(unsigned long,	state			)
620 		__field(	__u16, mode			)
621 		__field(unsigned long, dirtied_when		)
622 	),
623 
624 	TP_fast_assign(
625 		__entry->dev	= inode->i_sb->s_dev;
626 		__entry->ino	= inode->i_ino;
627 		__entry->state	= inode->i_state;
628 		__entry->mode	= inode->i_mode;
629 		__entry->dirtied_when = inode->dirtied_when;
630 	),
631 
632 	TP_printk("dev %d,%d ino %lu dirtied %lu state %s mode 0%o",
633 		  MAJOR(__entry->dev), MINOR(__entry->dev),
634 		  __entry->ino, __entry->dirtied_when,
635 		  show_inode_state(__entry->state), __entry->mode)
636 );
637 
638 DEFINE_EVENT(writeback_lazytime_template, writeback_lazytime,
639 	TP_PROTO(struct inode *inode),
640 
641 	TP_ARGS(inode)
642 );
643 
644 DEFINE_EVENT(writeback_lazytime_template, writeback_lazytime_iput,
645 	TP_PROTO(struct inode *inode),
646 
647 	TP_ARGS(inode)
648 );
649 
650 DEFINE_EVENT(writeback_lazytime_template, writeback_dirty_inode_enqueue,
651 
652 	TP_PROTO(struct inode *inode),
653 
654 	TP_ARGS(inode)
655 );
656 
657 #endif /* _TRACE_WRITEBACK_H */
658 
659 /* This part must be outside protection */
660 #include <trace/define_trace.h>
661