Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Robert Jarzmik | fe0bfaa | 2013-04-29 15:06:10 -0700 | [diff] [blame] | 2 | #undef TRACE_SYSTEM |
| 3 | #define TRACE_SYSTEM filemap |
| 4 | |
| 5 | #if !defined(_TRACE_FILEMAP_H) || defined(TRACE_HEADER_MULTI_READ) |
| 6 | #define _TRACE_FILEMAP_H |
| 7 | |
| 8 | #include <linux/types.h> |
| 9 | #include <linux/tracepoint.h> |
| 10 | #include <linux/mm.h> |
| 11 | #include <linux/memcontrol.h> |
| 12 | #include <linux/device.h> |
| 13 | #include <linux/kdev_t.h> |
Jeff Layton | 5660e13 | 2017-07-06 07:02:25 -0400 | [diff] [blame] | 14 | #include <linux/errseq.h> |
Robert Jarzmik | fe0bfaa | 2013-04-29 15:06:10 -0700 | [diff] [blame] | 15 | |
| 16 | DECLARE_EVENT_CLASS(mm_filemap_op_page_cache, |
| 17 | |
Matthew Wilcox (Oracle) | a0580c6 | 2021-07-23 09:29:46 -0400 | [diff] [blame] | 18 | TP_PROTO(struct folio *folio), |
Robert Jarzmik | fe0bfaa | 2013-04-29 15:06:10 -0700 | [diff] [blame] | 19 | |
Matthew Wilcox (Oracle) | a0580c6 | 2021-07-23 09:29:46 -0400 | [diff] [blame] | 20 | TP_ARGS(folio), |
Robert Jarzmik | fe0bfaa | 2013-04-29 15:06:10 -0700 | [diff] [blame] | 21 | |
| 22 | TP_STRUCT__entry( |
Namhyung Kim | 9fdd8a8 | 2015-04-06 14:36:09 +0900 | [diff] [blame] | 23 | __field(unsigned long, pfn) |
Robert Jarzmik | fe0bfaa | 2013-04-29 15:06:10 -0700 | [diff] [blame] | 24 | __field(unsigned long, i_ino) |
| 25 | __field(unsigned long, index) |
| 26 | __field(dev_t, s_dev) |
Matthew Wilcox (Oracle) | a0580c6 | 2021-07-23 09:29:46 -0400 | [diff] [blame] | 27 | __field(unsigned char, order) |
Robert Jarzmik | fe0bfaa | 2013-04-29 15:06:10 -0700 | [diff] [blame] | 28 | ), |
| 29 | |
| 30 | TP_fast_assign( |
Matthew Wilcox (Oracle) | a0580c6 | 2021-07-23 09:29:46 -0400 | [diff] [blame] | 31 | __entry->pfn = folio_pfn(folio); |
| 32 | __entry->i_ino = folio->mapping->host->i_ino; |
| 33 | __entry->index = folio->index; |
| 34 | if (folio->mapping->host->i_sb) |
| 35 | __entry->s_dev = folio->mapping->host->i_sb->s_dev; |
Robert Jarzmik | fe0bfaa | 2013-04-29 15:06:10 -0700 | [diff] [blame] | 36 | else |
Matthew Wilcox (Oracle) | a0580c6 | 2021-07-23 09:29:46 -0400 | [diff] [blame] | 37 | __entry->s_dev = folio->mapping->host->i_rdev; |
| 38 | __entry->order = folio_order(folio); |
Robert Jarzmik | fe0bfaa | 2013-04-29 15:06:10 -0700 | [diff] [blame] | 39 | ), |
| 40 | |
Matthew Wilcox (Oracle) | a0580c6 | 2021-07-23 09:29:46 -0400 | [diff] [blame] | 41 | TP_printk("dev %d:%d ino %lx pfn=0x%lx ofs=%lu order=%u", |
Robert Jarzmik | fe0bfaa | 2013-04-29 15:06:10 -0700 | [diff] [blame] | 42 | MAJOR(__entry->s_dev), MINOR(__entry->s_dev), |
| 43 | __entry->i_ino, |
Namhyung Kim | 9fdd8a8 | 2015-04-06 14:36:09 +0900 | [diff] [blame] | 44 | __entry->pfn, |
Matthew Wilcox (Oracle) | a0580c6 | 2021-07-23 09:29:46 -0400 | [diff] [blame] | 45 | __entry->index << PAGE_SHIFT, |
| 46 | __entry->order) |
Robert Jarzmik | fe0bfaa | 2013-04-29 15:06:10 -0700 | [diff] [blame] | 47 | ); |
| 48 | |
| 49 | DEFINE_EVENT(mm_filemap_op_page_cache, mm_filemap_delete_from_page_cache, |
Matthew Wilcox (Oracle) | a0580c6 | 2021-07-23 09:29:46 -0400 | [diff] [blame] | 50 | TP_PROTO(struct folio *folio), |
| 51 | TP_ARGS(folio) |
Robert Jarzmik | fe0bfaa | 2013-04-29 15:06:10 -0700 | [diff] [blame] | 52 | ); |
| 53 | |
| 54 | DEFINE_EVENT(mm_filemap_op_page_cache, mm_filemap_add_to_page_cache, |
Matthew Wilcox (Oracle) | a0580c6 | 2021-07-23 09:29:46 -0400 | [diff] [blame] | 55 | TP_PROTO(struct folio *folio), |
| 56 | TP_ARGS(folio) |
Robert Jarzmik | fe0bfaa | 2013-04-29 15:06:10 -0700 | [diff] [blame] | 57 | ); |
| 58 | |
Jeff Layton | 5660e13 | 2017-07-06 07:02:25 -0400 | [diff] [blame] | 59 | TRACE_EVENT(filemap_set_wb_err, |
| 60 | TP_PROTO(struct address_space *mapping, errseq_t eseq), |
| 61 | |
| 62 | TP_ARGS(mapping, eseq), |
| 63 | |
| 64 | TP_STRUCT__entry( |
| 65 | __field(unsigned long, i_ino) |
| 66 | __field(dev_t, s_dev) |
| 67 | __field(errseq_t, errseq) |
| 68 | ), |
| 69 | |
| 70 | TP_fast_assign( |
| 71 | __entry->i_ino = mapping->host->i_ino; |
| 72 | __entry->errseq = eseq; |
| 73 | if (mapping->host->i_sb) |
| 74 | __entry->s_dev = mapping->host->i_sb->s_dev; |
| 75 | else |
| 76 | __entry->s_dev = mapping->host->i_rdev; |
| 77 | ), |
| 78 | |
| 79 | TP_printk("dev=%d:%d ino=0x%lx errseq=0x%x", |
| 80 | MAJOR(__entry->s_dev), MINOR(__entry->s_dev), |
| 81 | __entry->i_ino, __entry->errseq) |
| 82 | ); |
| 83 | |
| 84 | TRACE_EVENT(file_check_and_advance_wb_err, |
| 85 | TP_PROTO(struct file *file, errseq_t old), |
| 86 | |
| 87 | TP_ARGS(file, old), |
| 88 | |
| 89 | TP_STRUCT__entry( |
Peter Zijlstra | 04ae87a | 2019-10-24 22:26:59 +0200 | [diff] [blame] | 90 | __field(struct file *, file) |
Jeff Layton | 5660e13 | 2017-07-06 07:02:25 -0400 | [diff] [blame] | 91 | __field(unsigned long, i_ino) |
| 92 | __field(dev_t, s_dev) |
| 93 | __field(errseq_t, old) |
| 94 | __field(errseq_t, new) |
| 95 | ), |
| 96 | |
| 97 | TP_fast_assign( |
| 98 | __entry->file = file; |
| 99 | __entry->i_ino = file->f_mapping->host->i_ino; |
| 100 | if (file->f_mapping->host->i_sb) |
| 101 | __entry->s_dev = |
| 102 | file->f_mapping->host->i_sb->s_dev; |
| 103 | else |
| 104 | __entry->s_dev = |
| 105 | file->f_mapping->host->i_rdev; |
| 106 | __entry->old = old; |
| 107 | __entry->new = file->f_wb_err; |
| 108 | ), |
| 109 | |
| 110 | TP_printk("file=%p dev=%d:%d ino=0x%lx old=0x%x new=0x%x", |
| 111 | __entry->file, MAJOR(__entry->s_dev), |
| 112 | MINOR(__entry->s_dev), __entry->i_ino, __entry->old, |
| 113 | __entry->new) |
| 114 | ); |
Robert Jarzmik | fe0bfaa | 2013-04-29 15:06:10 -0700 | [diff] [blame] | 115 | #endif /* _TRACE_FILEMAP_H */ |
| 116 | |
| 117 | /* This part must be outside protection */ |
| 118 | #include <trace/define_trace.h> |