filemap.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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 folio *folio),
  15. TP_ARGS(folio),
  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. __field(unsigned char, order)
  22. ),
  23. TP_fast_assign(
  24. __entry->pfn = folio_pfn(folio);
  25. __entry->i_ino = folio->mapping->host->i_ino;
  26. __entry->index = folio->index;
  27. if (folio->mapping->host->i_sb)
  28. __entry->s_dev = folio->mapping->host->i_sb->s_dev;
  29. else
  30. __entry->s_dev = folio->mapping->host->i_rdev;
  31. __entry->order = folio_order(folio);
  32. ),
  33. TP_printk("dev %d:%d ino %lx pfn=0x%lx ofs=%lu order=%u",
  34. MAJOR(__entry->s_dev), MINOR(__entry->s_dev),
  35. __entry->i_ino,
  36. __entry->pfn,
  37. __entry->index << PAGE_SHIFT,
  38. __entry->order)
  39. );
  40. DEFINE_EVENT(mm_filemap_op_page_cache, mm_filemap_delete_from_page_cache,
  41. TP_PROTO(struct folio *folio),
  42. TP_ARGS(folio)
  43. );
  44. DEFINE_EVENT(mm_filemap_op_page_cache, mm_filemap_add_to_page_cache,
  45. TP_PROTO(struct folio *folio),
  46. TP_ARGS(folio)
  47. );
  48. TRACE_EVENT(filemap_set_wb_err,
  49. TP_PROTO(struct address_space *mapping, errseq_t eseq),
  50. TP_ARGS(mapping, eseq),
  51. TP_STRUCT__entry(
  52. __field(unsigned long, i_ino)
  53. __field(dev_t, s_dev)
  54. __field(errseq_t, errseq)
  55. ),
  56. TP_fast_assign(
  57. __entry->i_ino = mapping->host->i_ino;
  58. __entry->errseq = eseq;
  59. if (mapping->host->i_sb)
  60. __entry->s_dev = mapping->host->i_sb->s_dev;
  61. else
  62. __entry->s_dev = mapping->host->i_rdev;
  63. ),
  64. TP_printk("dev=%d:%d ino=0x%lx errseq=0x%x",
  65. MAJOR(__entry->s_dev), MINOR(__entry->s_dev),
  66. __entry->i_ino, __entry->errseq)
  67. );
  68. TRACE_EVENT(file_check_and_advance_wb_err,
  69. TP_PROTO(struct file *file, errseq_t old),
  70. TP_ARGS(file, old),
  71. TP_STRUCT__entry(
  72. __field(struct file *, file)
  73. __field(unsigned long, i_ino)
  74. __field(dev_t, s_dev)
  75. __field(errseq_t, old)
  76. __field(errseq_t, new)
  77. ),
  78. TP_fast_assign(
  79. __entry->file = file;
  80. __entry->i_ino = file->f_mapping->host->i_ino;
  81. if (file->f_mapping->host->i_sb)
  82. __entry->s_dev =
  83. file->f_mapping->host->i_sb->s_dev;
  84. else
  85. __entry->s_dev =
  86. file->f_mapping->host->i_rdev;
  87. __entry->old = old;
  88. __entry->new = file->f_wb_err;
  89. ),
  90. TP_printk("file=%p dev=%d:%d ino=0x%lx old=0x%x new=0x%x",
  91. __entry->file, MAJOR(__entry->s_dev),
  92. MINOR(__entry->s_dev), __entry->i_ino, __entry->old,
  93. __entry->new)
  94. );
  95. #endif /* _TRACE_FILEMAP_H */
  96. /* This part must be outside protection */
  97. #include <trace/define_trace.h>