xref: /linux/include/trace/events/filemap.h (revision 2fe05e1139a555ae91f00a812cb9520e7d3022ab)
1 #undef TRACE_SYSTEM
2 #define TRACE_SYSTEM filemap
3 
4 #if !defined(_TRACE_FILEMAP_H) || defined(TRACE_HEADER_MULTI_READ)
5 #define _TRACE_FILEMAP_H
6 
7 #include <linux/types.h>
8 #include <linux/tracepoint.h>
9 #include <linux/mm.h>
10 #include <linux/memcontrol.h>
11 #include <linux/device.h>
12 #include <linux/kdev_t.h>
13 #include <linux/errseq.h>
14 
15 DECLARE_EVENT_CLASS(mm_filemap_op_page_cache,
16 
17 	TP_PROTO(struct page *page),
18 
19 	TP_ARGS(page),
20 
21 	TP_STRUCT__entry(
22 		__field(unsigned long, pfn)
23 		__field(unsigned long, i_ino)
24 		__field(unsigned long, index)
25 		__field(dev_t, s_dev)
26 	),
27 
28 	TP_fast_assign(
29 		__entry->pfn = page_to_pfn(page);
30 		__entry->i_ino = page->mapping->host->i_ino;
31 		__entry->index = page->index;
32 		if (page->mapping->host->i_sb)
33 			__entry->s_dev = page->mapping->host->i_sb->s_dev;
34 		else
35 			__entry->s_dev = page->mapping->host->i_rdev;
36 	),
37 
38 	TP_printk("dev %d:%d ino %lx page=%p pfn=%lu ofs=%lu",
39 		MAJOR(__entry->s_dev), MINOR(__entry->s_dev),
40 		__entry->i_ino,
41 		pfn_to_page(__entry->pfn),
42 		__entry->pfn,
43 		__entry->index << PAGE_SHIFT)
44 );
45 
46 DEFINE_EVENT(mm_filemap_op_page_cache, mm_filemap_delete_from_page_cache,
47 	TP_PROTO(struct page *page),
48 	TP_ARGS(page)
49 	);
50 
51 DEFINE_EVENT(mm_filemap_op_page_cache, mm_filemap_add_to_page_cache,
52 	TP_PROTO(struct page *page),
53 	TP_ARGS(page)
54 	);
55 
56 TRACE_EVENT(filemap_set_wb_err,
57 		TP_PROTO(struct address_space *mapping, errseq_t eseq),
58 
59 		TP_ARGS(mapping, eseq),
60 
61 		TP_STRUCT__entry(
62 			__field(unsigned long, i_ino)
63 			__field(dev_t, s_dev)
64 			__field(errseq_t, errseq)
65 		),
66 
67 		TP_fast_assign(
68 			__entry->i_ino = mapping->host->i_ino;
69 			__entry->errseq = eseq;
70 			if (mapping->host->i_sb)
71 				__entry->s_dev = mapping->host->i_sb->s_dev;
72 			else
73 				__entry->s_dev = mapping->host->i_rdev;
74 		),
75 
76 		TP_printk("dev=%d:%d ino=0x%lx errseq=0x%x",
77 			MAJOR(__entry->s_dev), MINOR(__entry->s_dev),
78 			__entry->i_ino, __entry->errseq)
79 );
80 
81 TRACE_EVENT(file_check_and_advance_wb_err,
82 		TP_PROTO(struct file *file, errseq_t old),
83 
84 		TP_ARGS(file, old),
85 
86 		TP_STRUCT__entry(
87 			__field(struct file *, file);
88 			__field(unsigned long, i_ino)
89 			__field(dev_t, s_dev)
90 			__field(errseq_t, old)
91 			__field(errseq_t, new)
92 		),
93 
94 		TP_fast_assign(
95 			__entry->file = file;
96 			__entry->i_ino = file->f_mapping->host->i_ino;
97 			if (file->f_mapping->host->i_sb)
98 				__entry->s_dev =
99 					file->f_mapping->host->i_sb->s_dev;
100 			else
101 				__entry->s_dev =
102 					file->f_mapping->host->i_rdev;
103 			__entry->old = old;
104 			__entry->new = file->f_wb_err;
105 		),
106 
107 		TP_printk("file=%p dev=%d:%d ino=0x%lx old=0x%x new=0x%x",
108 			__entry->file, MAJOR(__entry->s_dev),
109 			MINOR(__entry->s_dev), __entry->i_ino, __entry->old,
110 			__entry->new)
111 );
112 #endif /* _TRACE_FILEMAP_H */
113 
114 /* This part must be outside protection */
115 #include <trace/define_trace.h>
116