timestamp.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #undef TRACE_SYSTEM
  3. #define TRACE_SYSTEM timestamp
  4. #if !defined(_TRACE_TIMESTAMP_H) || defined(TRACE_HEADER_MULTI_READ)
  5. #define _TRACE_TIMESTAMP_H
  6. #include <linux/tracepoint.h>
  7. #include <linux/fs.h>
  8. #define CTIME_QUERIED_FLAGS \
  9. { I_CTIME_QUERIED, "Q" }
  10. DECLARE_EVENT_CLASS(ctime,
  11. TP_PROTO(struct inode *inode,
  12. struct timespec64 *ctime),
  13. TP_ARGS(inode, ctime),
  14. TP_STRUCT__entry(
  15. __field(dev_t, dev)
  16. __field(ino_t, ino)
  17. __field(time64_t, ctime_s)
  18. __field(u32, ctime_ns)
  19. __field(u32, gen)
  20. ),
  21. TP_fast_assign(
  22. __entry->dev = inode->i_sb->s_dev;
  23. __entry->ino = inode->i_ino;
  24. __entry->gen = inode->i_generation;
  25. __entry->ctime_s = ctime->tv_sec;
  26. __entry->ctime_ns = ctime->tv_nsec;
  27. ),
  28. TP_printk("ino=%d:%d:%ld:%u ctime=%lld.%u",
  29. MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino, __entry->gen,
  30. __entry->ctime_s, __entry->ctime_ns
  31. )
  32. );
  33. DEFINE_EVENT(ctime, inode_set_ctime_to_ts,
  34. TP_PROTO(struct inode *inode,
  35. struct timespec64 *ctime),
  36. TP_ARGS(inode, ctime));
  37. DEFINE_EVENT(ctime, ctime_xchg_skip,
  38. TP_PROTO(struct inode *inode,
  39. struct timespec64 *ctime),
  40. TP_ARGS(inode, ctime));
  41. TRACE_EVENT(ctime_ns_xchg,
  42. TP_PROTO(struct inode *inode,
  43. u32 old,
  44. u32 new,
  45. u32 cur),
  46. TP_ARGS(inode, old, new, cur),
  47. TP_STRUCT__entry(
  48. __field(dev_t, dev)
  49. __field(ino_t, ino)
  50. __field(u32, gen)
  51. __field(u32, old)
  52. __field(u32, new)
  53. __field(u32, cur)
  54. ),
  55. TP_fast_assign(
  56. __entry->dev = inode->i_sb->s_dev;
  57. __entry->ino = inode->i_ino;
  58. __entry->gen = inode->i_generation;
  59. __entry->old = old;
  60. __entry->new = new;
  61. __entry->cur = cur;
  62. ),
  63. TP_printk("ino=%d:%d:%ld:%u old=%u:%s new=%u cur=%u:%s",
  64. MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino, __entry->gen,
  65. __entry->old & ~I_CTIME_QUERIED,
  66. __print_flags(__entry->old & I_CTIME_QUERIED, "|", CTIME_QUERIED_FLAGS),
  67. __entry->new,
  68. __entry->cur & ~I_CTIME_QUERIED,
  69. __print_flags(__entry->cur & I_CTIME_QUERIED, "|", CTIME_QUERIED_FLAGS)
  70. )
  71. );
  72. TRACE_EVENT(fill_mg_cmtime,
  73. TP_PROTO(struct inode *inode,
  74. struct timespec64 *ctime,
  75. struct timespec64 *mtime),
  76. TP_ARGS(inode, ctime, mtime),
  77. TP_STRUCT__entry(
  78. __field(dev_t, dev)
  79. __field(ino_t, ino)
  80. __field(time64_t, ctime_s)
  81. __field(time64_t, mtime_s)
  82. __field(u32, ctime_ns)
  83. __field(u32, mtime_ns)
  84. __field(u32, gen)
  85. ),
  86. TP_fast_assign(
  87. __entry->dev = inode->i_sb->s_dev;
  88. __entry->ino = inode->i_ino;
  89. __entry->gen = inode->i_generation;
  90. __entry->ctime_s = ctime->tv_sec;
  91. __entry->mtime_s = mtime->tv_sec;
  92. __entry->ctime_ns = ctime->tv_nsec;
  93. __entry->mtime_ns = mtime->tv_nsec;
  94. ),
  95. TP_printk("ino=%d:%d:%ld:%u ctime=%lld.%u mtime=%lld.%u",
  96. MAJOR(__entry->dev), MINOR(__entry->dev), __entry->ino, __entry->gen,
  97. __entry->ctime_s, __entry->ctime_ns,
  98. __entry->mtime_s, __entry->mtime_ns
  99. )
  100. );
  101. #endif /* _TRACE_TIMESTAMP_H */
  102. /* This part must be outside protection */
  103. #include <trace/define_trace.h>