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