1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM filemap
5 #if !defined(_TRACE_FILEMAP_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_FILEMAP_H
8 #include <linux/types.h>
9 #include <linux/tracepoint.h>
11 #include <linux/memcontrol.h>
12 #include <linux/device.h>
13 #include <linux/kdev_t.h>
14 #include <linux/errseq.h>
16 DECLARE_EVENT_CLASS(mm_filemap_op_page_cache
,
18 TP_PROTO(struct page
*page
),
23 __field(unsigned long, pfn
)
24 __field(unsigned long, i_ino
)
25 __field(unsigned long, index
)
30 __entry
->pfn
= page_to_pfn(page
);
31 __entry
->i_ino
= page
->mapping
->host
->i_ino
;
32 __entry
->index
= page
->index
;
33 if (page
->mapping
->host
->i_sb
)
34 __entry
->s_dev
= page
->mapping
->host
->i_sb
->s_dev
;
36 __entry
->s_dev
= page
->mapping
->host
->i_rdev
;
39 TP_printk("dev %d:%d ino %lx page=%p pfn=%lu ofs=%lu",
40 MAJOR(__entry
->s_dev
), MINOR(__entry
->s_dev
),
42 pfn_to_page(__entry
->pfn
),
44 __entry
->index
<< PAGE_SHIFT
)
47 DEFINE_EVENT(mm_filemap_op_page_cache
, mm_filemap_delete_from_page_cache
,
48 TP_PROTO(struct page
*page
),
52 DEFINE_EVENT(mm_filemap_op_page_cache
, mm_filemap_add_to_page_cache
,
53 TP_PROTO(struct page
*page
),
57 TRACE_EVENT(filemap_set_wb_err
,
58 TP_PROTO(struct address_space
*mapping
, errseq_t eseq
),
60 TP_ARGS(mapping
, eseq
),
63 __field(unsigned long, i_ino
)
65 __field(errseq_t
, errseq
)
69 __entry
->i_ino
= mapping
->host
->i_ino
;
70 __entry
->errseq
= eseq
;
71 if (mapping
->host
->i_sb
)
72 __entry
->s_dev
= mapping
->host
->i_sb
->s_dev
;
74 __entry
->s_dev
= mapping
->host
->i_rdev
;
77 TP_printk("dev=%d:%d ino=0x%lx errseq=0x%x",
78 MAJOR(__entry
->s_dev
), MINOR(__entry
->s_dev
),
79 __entry
->i_ino
, __entry
->errseq
)
82 TRACE_EVENT(file_check_and_advance_wb_err
,
83 TP_PROTO(struct file
*file
, errseq_t old
),
88 __field(struct file
*, file
)
89 __field(unsigned long, i_ino
)
91 __field(errseq_t
, old
)
92 __field(errseq_t
, new)
97 __entry
->i_ino
= file
->f_mapping
->host
->i_ino
;
98 if (file
->f_mapping
->host
->i_sb
)
100 file
->f_mapping
->host
->i_sb
->s_dev
;
103 file
->f_mapping
->host
->i_rdev
;
105 __entry
->new = file
->f_wb_err
;
108 TP_printk("file=%p dev=%d:%d ino=0x%lx old=0x%x new=0x%x",
109 __entry
->file
, MAJOR(__entry
->s_dev
),
110 MINOR(__entry
->s_dev
), __entry
->i_ino
, __entry
->old
,
113 #endif /* _TRACE_FILEMAP_H */
115 /* This part must be outside protection */
116 #include <trace/define_trace.h>