Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #undef TRACE_SYSTEM
0003 #define TRACE_SYSTEM filemap
0004 
0005 #if !defined(_TRACE_FILEMAP_H) || defined(TRACE_HEADER_MULTI_READ)
0006 #define _TRACE_FILEMAP_H
0007 
0008 #include <linux/types.h>
0009 #include <linux/tracepoint.h>
0010 #include <linux/mm.h>
0011 #include <linux/memcontrol.h>
0012 #include <linux/device.h>
0013 #include <linux/kdev_t.h>
0014 #include <linux/errseq.h>
0015 
0016 DECLARE_EVENT_CLASS(mm_filemap_op_page_cache,
0017 
0018     TP_PROTO(struct folio *folio),
0019 
0020     TP_ARGS(folio),
0021 
0022     TP_STRUCT__entry(
0023         __field(unsigned long, pfn)
0024         __field(unsigned long, i_ino)
0025         __field(unsigned long, index)
0026         __field(dev_t, s_dev)
0027         __field(unsigned char, order)
0028     ),
0029 
0030     TP_fast_assign(
0031         __entry->pfn = folio_pfn(folio);
0032         __entry->i_ino = folio->mapping->host->i_ino;
0033         __entry->index = folio->index;
0034         if (folio->mapping->host->i_sb)
0035             __entry->s_dev = folio->mapping->host->i_sb->s_dev;
0036         else
0037             __entry->s_dev = folio->mapping->host->i_rdev;
0038         __entry->order = folio_order(folio);
0039     ),
0040 
0041     TP_printk("dev %d:%d ino %lx pfn=0x%lx ofs=%lu order=%u",
0042         MAJOR(__entry->s_dev), MINOR(__entry->s_dev),
0043         __entry->i_ino,
0044         __entry->pfn,
0045         __entry->index << PAGE_SHIFT,
0046         __entry->order)
0047 );
0048 
0049 DEFINE_EVENT(mm_filemap_op_page_cache, mm_filemap_delete_from_page_cache,
0050     TP_PROTO(struct folio *folio),
0051     TP_ARGS(folio)
0052     );
0053 
0054 DEFINE_EVENT(mm_filemap_op_page_cache, mm_filemap_add_to_page_cache,
0055     TP_PROTO(struct folio *folio),
0056     TP_ARGS(folio)
0057     );
0058 
0059 TRACE_EVENT(filemap_set_wb_err,
0060         TP_PROTO(struct address_space *mapping, errseq_t eseq),
0061 
0062         TP_ARGS(mapping, eseq),
0063 
0064         TP_STRUCT__entry(
0065             __field(unsigned long, i_ino)
0066             __field(dev_t, s_dev)
0067             __field(errseq_t, errseq)
0068         ),
0069 
0070         TP_fast_assign(
0071             __entry->i_ino = mapping->host->i_ino;
0072             __entry->errseq = eseq;
0073             if (mapping->host->i_sb)
0074                 __entry->s_dev = mapping->host->i_sb->s_dev;
0075             else
0076                 __entry->s_dev = mapping->host->i_rdev;
0077         ),
0078 
0079         TP_printk("dev=%d:%d ino=0x%lx errseq=0x%x",
0080             MAJOR(__entry->s_dev), MINOR(__entry->s_dev),
0081             __entry->i_ino, __entry->errseq)
0082 );
0083 
0084 TRACE_EVENT(file_check_and_advance_wb_err,
0085         TP_PROTO(struct file *file, errseq_t old),
0086 
0087         TP_ARGS(file, old),
0088 
0089         TP_STRUCT__entry(
0090             __field(struct file *, file)
0091             __field(unsigned long, i_ino)
0092             __field(dev_t, s_dev)
0093             __field(errseq_t, old)
0094             __field(errseq_t, new)
0095         ),
0096 
0097         TP_fast_assign(
0098             __entry->file = file;
0099             __entry->i_ino = file->f_mapping->host->i_ino;
0100             if (file->f_mapping->host->i_sb)
0101                 __entry->s_dev =
0102                     file->f_mapping->host->i_sb->s_dev;
0103             else
0104                 __entry->s_dev =
0105                     file->f_mapping->host->i_rdev;
0106             __entry->old = old;
0107             __entry->new = file->f_wb_err;
0108         ),
0109 
0110         TP_printk("file=%p dev=%d:%d ino=0x%lx old=0x%x new=0x%x",
0111             __entry->file, MAJOR(__entry->s_dev),
0112             MINOR(__entry->s_dev), __entry->i_ino, __entry->old,
0113             __entry->new)
0114 );
0115 #endif /* _TRACE_FILEMAP_H */
0116 
0117 /* This part must be outside protection */
0118 #include <trace/define_trace.h>