filemap.h 2.7 KB

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