filemap.h 2.7 KB

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