1 /* SPDX-License-Identifier: GPL-2.0 */ 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #undef TRACE_SYSTEM 2 #undef TRACE_SYSTEM 3 #define TRACE_SYSTEM filemap 3 #define TRACE_SYSTEM filemap 4 4 5 #if !defined(_TRACE_FILEMAP_H) || defined(TRAC 5 #if !defined(_TRACE_FILEMAP_H) || defined(TRACE_HEADER_MULTI_READ) 6 #define _TRACE_FILEMAP_H 6 #define _TRACE_FILEMAP_H 7 7 8 #include <linux/types.h> 8 #include <linux/types.h> 9 #include <linux/tracepoint.h> 9 #include <linux/tracepoint.h> 10 #include <linux/mm.h> 10 #include <linux/mm.h> 11 #include <linux/memcontrol.h> 11 #include <linux/memcontrol.h> 12 #include <linux/device.h> 12 #include <linux/device.h> 13 #include <linux/kdev_t.h> 13 #include <linux/kdev_t.h> 14 #include <linux/errseq.h> 14 #include <linux/errseq.h> 15 15 16 DECLARE_EVENT_CLASS(mm_filemap_op_page_cache, 16 DECLARE_EVENT_CLASS(mm_filemap_op_page_cache, 17 17 18 TP_PROTO(struct folio *folio), 18 TP_PROTO(struct folio *folio), 19 19 20 TP_ARGS(folio), 20 TP_ARGS(folio), 21 21 22 TP_STRUCT__entry( 22 TP_STRUCT__entry( 23 __field(unsigned long, pfn) 23 __field(unsigned long, pfn) 24 __field(unsigned long, i_ino) 24 __field(unsigned long, i_ino) 25 __field(unsigned long, index) 25 __field(unsigned long, index) 26 __field(dev_t, s_dev) 26 __field(dev_t, s_dev) 27 __field(unsigned char, order) 27 __field(unsigned char, order) 28 ), 28 ), 29 29 30 TP_fast_assign( 30 TP_fast_assign( 31 __entry->pfn = folio_pfn(folio 31 __entry->pfn = folio_pfn(folio); 32 __entry->i_ino = folio->mappin 32 __entry->i_ino = folio->mapping->host->i_ino; 33 __entry->index = folio->index; 33 __entry->index = folio->index; 34 if (folio->mapping->host->i_sb 34 if (folio->mapping->host->i_sb) 35 __entry->s_dev = folio 35 __entry->s_dev = folio->mapping->host->i_sb->s_dev; 36 else 36 else 37 __entry->s_dev = folio 37 __entry->s_dev = folio->mapping->host->i_rdev; 38 __entry->order = folio_order(f 38 __entry->order = folio_order(folio); 39 ), 39 ), 40 40 41 TP_printk("dev %d:%d ino %lx pfn=0x%lx 41 TP_printk("dev %d:%d ino %lx pfn=0x%lx ofs=%lu order=%u", 42 MAJOR(__entry->s_dev), MINOR(_ 42 MAJOR(__entry->s_dev), MINOR(__entry->s_dev), 43 __entry->i_ino, 43 __entry->i_ino, 44 __entry->pfn, 44 __entry->pfn, 45 __entry->index << PAGE_SHIFT, 45 __entry->index << PAGE_SHIFT, 46 __entry->order) 46 __entry->order) 47 ); 47 ); 48 48 49 DEFINE_EVENT(mm_filemap_op_page_cache, mm_file 49 DEFINE_EVENT(mm_filemap_op_page_cache, mm_filemap_delete_from_page_cache, 50 TP_PROTO(struct folio *folio), 50 TP_PROTO(struct folio *folio), 51 TP_ARGS(folio) 51 TP_ARGS(folio) 52 ); 52 ); 53 53 54 DEFINE_EVENT(mm_filemap_op_page_cache, mm_file 54 DEFINE_EVENT(mm_filemap_op_page_cache, mm_filemap_add_to_page_cache, 55 TP_PROTO(struct folio *folio), 55 TP_PROTO(struct folio *folio), 56 TP_ARGS(folio) 56 TP_ARGS(folio) 57 ); 57 ); 58 58 59 DECLARE_EVENT_CLASS(mm_filemap_op_page_cache_r 59 DECLARE_EVENT_CLASS(mm_filemap_op_page_cache_range, 60 60 61 TP_PROTO( 61 TP_PROTO( 62 struct address_space *mapping, 62 struct address_space *mapping, 63 pgoff_t index, 63 pgoff_t index, 64 pgoff_t last_index 64 pgoff_t last_index 65 ), 65 ), 66 66 67 TP_ARGS(mapping, index, last_index), 67 TP_ARGS(mapping, index, last_index), 68 68 69 TP_STRUCT__entry( 69 TP_STRUCT__entry( 70 __field(unsigned long, i_ino) 70 __field(unsigned long, i_ino) 71 __field(dev_t, s_dev) 71 __field(dev_t, s_dev) 72 __field(unsigned long, index) 72 __field(unsigned long, index) 73 __field(unsigned long, last_in 73 __field(unsigned long, last_index) 74 ), 74 ), 75 75 76 TP_fast_assign( 76 TP_fast_assign( 77 __entry->i_ino = mapping->host 77 __entry->i_ino = mapping->host->i_ino; 78 if (mapping->host->i_sb) 78 if (mapping->host->i_sb) 79 __entry->s_dev = 79 __entry->s_dev = 80 mapping->host- 80 mapping->host->i_sb->s_dev; 81 else 81 else 82 __entry->s_dev = mappi 82 __entry->s_dev = mapping->host->i_rdev; 83 __entry->index = index; 83 __entry->index = index; 84 __entry->last_index = last_ind 84 __entry->last_index = last_index; 85 ), 85 ), 86 86 87 TP_printk( 87 TP_printk( 88 "dev=%d:%d ino=%lx ofs=%lld-%l 88 "dev=%d:%d ino=%lx ofs=%lld-%lld", 89 MAJOR(__entry->s_dev), 89 MAJOR(__entry->s_dev), 90 MINOR(__entry->s_dev), __entry 90 MINOR(__entry->s_dev), __entry->i_ino, 91 ((loff_t)__entry->index) << PA 91 ((loff_t)__entry->index) << PAGE_SHIFT, 92 ((((loff_t)__entry->last_index 92 ((((loff_t)__entry->last_index + 1) << PAGE_SHIFT) - 1) 93 ) 93 ) 94 ); 94 ); 95 95 96 DEFINE_EVENT(mm_filemap_op_page_cache_range, m 96 DEFINE_EVENT(mm_filemap_op_page_cache_range, mm_filemap_get_pages, 97 TP_PROTO( 97 TP_PROTO( 98 struct address_space *mapping, 98 struct address_space *mapping, 99 pgoff_t index, 99 pgoff_t index, 100 pgoff_t last_index 100 pgoff_t last_index 101 ), 101 ), 102 TP_ARGS(mapping, index, last_index) 102 TP_ARGS(mapping, index, last_index) 103 ); 103 ); 104 104 105 DEFINE_EVENT(mm_filemap_op_page_cache_range, m 105 DEFINE_EVENT(mm_filemap_op_page_cache_range, mm_filemap_map_pages, 106 TP_PROTO( 106 TP_PROTO( 107 struct address_space *mapping, 107 struct address_space *mapping, 108 pgoff_t index, 108 pgoff_t index, 109 pgoff_t last_index 109 pgoff_t last_index 110 ), 110 ), 111 TP_ARGS(mapping, index, last_index) 111 TP_ARGS(mapping, index, last_index) 112 ); 112 ); 113 113 114 TRACE_EVENT(mm_filemap_fault, 114 TRACE_EVENT(mm_filemap_fault, 115 TP_PROTO(struct address_space *mapping 115 TP_PROTO(struct address_space *mapping, pgoff_t index), 116 116 117 TP_ARGS(mapping, index), 117 TP_ARGS(mapping, index), 118 118 119 TP_STRUCT__entry( 119 TP_STRUCT__entry( 120 __field(unsigned long, i_ino) 120 __field(unsigned long, i_ino) 121 __field(dev_t, s_dev) 121 __field(dev_t, s_dev) 122 __field(unsigned long, index) 122 __field(unsigned long, index) 123 ), 123 ), 124 124 125 TP_fast_assign( 125 TP_fast_assign( 126 __entry->i_ino = mapping->host 126 __entry->i_ino = mapping->host->i_ino; 127 if (mapping->host->i_sb) 127 if (mapping->host->i_sb) 128 __entry->s_dev = 128 __entry->s_dev = 129 mapping->host- 129 mapping->host->i_sb->s_dev; 130 else 130 else 131 __entry->s_dev = mappi 131 __entry->s_dev = mapping->host->i_rdev; 132 __entry->index = index; 132 __entry->index = index; 133 ), 133 ), 134 134 135 TP_printk( 135 TP_printk( 136 "dev=%d:%d ino=%lx ofs=%lld", 136 "dev=%d:%d ino=%lx ofs=%lld", 137 MAJOR(__entry->s_dev), 137 MAJOR(__entry->s_dev), 138 MINOR(__entry->s_dev), __entry 138 MINOR(__entry->s_dev), __entry->i_ino, 139 ((loff_t)__entry->index) << PA 139 ((loff_t)__entry->index) << PAGE_SHIFT 140 ) 140 ) 141 ); 141 ); 142 142 143 TRACE_EVENT(filemap_set_wb_err, 143 TRACE_EVENT(filemap_set_wb_err, 144 TP_PROTO(struct address_space 144 TP_PROTO(struct address_space *mapping, errseq_t eseq), 145 145 146 TP_ARGS(mapping, eseq), 146 TP_ARGS(mapping, eseq), 147 147 148 TP_STRUCT__entry( 148 TP_STRUCT__entry( 149 __field(unsigned long, 149 __field(unsigned long, i_ino) 150 __field(dev_t, s_dev) 150 __field(dev_t, s_dev) 151 __field(errseq_t, errs 151 __field(errseq_t, errseq) 152 ), 152 ), 153 153 154 TP_fast_assign( 154 TP_fast_assign( 155 __entry->i_ino = mappi 155 __entry->i_ino = mapping->host->i_ino; 156 __entry->errseq = eseq 156 __entry->errseq = eseq; 157 if (mapping->host->i_s 157 if (mapping->host->i_sb) 158 __entry->s_dev 158 __entry->s_dev = mapping->host->i_sb->s_dev; 159 else 159 else 160 __entry->s_dev 160 __entry->s_dev = mapping->host->i_rdev; 161 ), 161 ), 162 162 163 TP_printk("dev=%d:%d ino=0x%lx 163 TP_printk("dev=%d:%d ino=0x%lx errseq=0x%x", 164 MAJOR(__entry->s_dev), 164 MAJOR(__entry->s_dev), MINOR(__entry->s_dev), 165 __entry->i_ino, __entr 165 __entry->i_ino, __entry->errseq) 166 ); 166 ); 167 167 168 TRACE_EVENT(file_check_and_advance_wb_err, 168 TRACE_EVENT(file_check_and_advance_wb_err, 169 TP_PROTO(struct file *file, er 169 TP_PROTO(struct file *file, errseq_t old), 170 170 171 TP_ARGS(file, old), 171 TP_ARGS(file, old), 172 172 173 TP_STRUCT__entry( 173 TP_STRUCT__entry( 174 __field(struct file *, 174 __field(struct file *, file) 175 __field(unsigned long, 175 __field(unsigned long, i_ino) 176 __field(dev_t, s_dev) 176 __field(dev_t, s_dev) 177 __field(errseq_t, old) 177 __field(errseq_t, old) 178 __field(errseq_t, new) 178 __field(errseq_t, new) 179 ), 179 ), 180 180 181 TP_fast_assign( 181 TP_fast_assign( 182 __entry->file = file; 182 __entry->file = file; 183 __entry->i_ino = file- 183 __entry->i_ino = file->f_mapping->host->i_ino; 184 if (file->f_mapping->h 184 if (file->f_mapping->host->i_sb) 185 __entry->s_dev 185 __entry->s_dev = 186 file-> 186 file->f_mapping->host->i_sb->s_dev; 187 else 187 else 188 __entry->s_dev 188 __entry->s_dev = 189 file-> 189 file->f_mapping->host->i_rdev; 190 __entry->old = old; 190 __entry->old = old; 191 __entry->new = file->f 191 __entry->new = file->f_wb_err; 192 ), 192 ), 193 193 194 TP_printk("file=%p dev=%d:%d i 194 TP_printk("file=%p dev=%d:%d ino=0x%lx old=0x%x new=0x%x", 195 __entry->file, MAJOR(_ 195 __entry->file, MAJOR(__entry->s_dev), 196 MINOR(__entry->s_dev), 196 MINOR(__entry->s_dev), __entry->i_ino, __entry->old, 197 __entry->new) 197 __entry->new) 198 ); 198 ); 199 #endif /* _TRACE_FILEMAP_H */ 199 #endif /* _TRACE_FILEMAP_H */ 200 200 201 /* This part must be outside protection */ 201 /* This part must be outside protection */ 202 #include <trace/define_trace.h> 202 #include <trace/define_trace.h> 203 203
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.