ceph.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /* Ceph filesystem support module tracepoints
  3. *
  4. * Copyright (C) 2025 IONOS SE. All Rights Reserved.
  5. * Written by Max Kellermann (max.kellermann@ionos.com)
  6. */
  7. #undef TRACE_SYSTEM
  8. #define TRACE_SYSTEM ceph
  9. #if !defined(_TRACE_CEPH_H) || defined(TRACE_HEADER_MULTI_READ)
  10. #define _TRACE_CEPH_H
  11. #include <linux/tracepoint.h>
  12. #define ceph_mdsc_suspend_reasons \
  13. EM(ceph_mdsc_suspend_reason_no_mdsmap, "no-mdsmap") \
  14. EM(ceph_mdsc_suspend_reason_no_active_mds, "no-active-mds") \
  15. EM(ceph_mdsc_suspend_reason_rejected, "rejected") \
  16. E_(ceph_mdsc_suspend_reason_session, "session")
  17. #ifndef __NETFS_DECLARE_TRACE_ENUMS_ONCE_ONLY
  18. #define __NETFS_DECLARE_TRACE_ENUMS_ONCE_ONLY
  19. #undef EM
  20. #undef E_
  21. #define EM(a, b) a,
  22. #define E_(a, b) a
  23. enum ceph_mdsc_suspend_reason { ceph_mdsc_suspend_reasons } __mode(byte);
  24. #endif
  25. /*
  26. * Export enum symbols via userspace.
  27. */
  28. #undef EM
  29. #undef E_
  30. #define EM(a, b) TRACE_DEFINE_ENUM(a);
  31. #define E_(a, b) TRACE_DEFINE_ENUM(a);
  32. ceph_mdsc_suspend_reasons;
  33. /*
  34. * Now redefine the EM() and E_() macros to map the enums to the strings that
  35. * will be printed in the output.
  36. */
  37. #undef EM
  38. #undef E_
  39. #define EM(a, b) { a, b },
  40. #define E_(a, b) { a, b }
  41. TRACE_EVENT(ceph_mdsc_submit_request,
  42. TP_PROTO(struct ceph_mds_client *mdsc,
  43. struct ceph_mds_request *req),
  44. TP_ARGS(mdsc, req),
  45. TP_STRUCT__entry(
  46. __field(u64, tid)
  47. __field(int, op)
  48. __field(u64, ino)
  49. __field(u64, snap)
  50. ),
  51. TP_fast_assign(
  52. struct inode *inode;
  53. __entry->tid = req->r_tid;
  54. __entry->op = req->r_op;
  55. inode = req->r_inode;
  56. if (inode == NULL && req->r_dentry)
  57. inode = d_inode(req->r_dentry);
  58. if (inode) {
  59. __entry->ino = ceph_ino(inode);
  60. __entry->snap = ceph_snap(inode);
  61. } else {
  62. __entry->ino = __entry->snap = 0;
  63. }
  64. ),
  65. TP_printk("R=%llu op=%s ino=%llx,%llx",
  66. __entry->tid,
  67. ceph_mds_op_name(__entry->op),
  68. __entry->ino, __entry->snap)
  69. );
  70. TRACE_EVENT(ceph_mdsc_suspend_request,
  71. TP_PROTO(struct ceph_mds_client *mdsc,
  72. struct ceph_mds_session *session,
  73. struct ceph_mds_request *req,
  74. enum ceph_mdsc_suspend_reason reason),
  75. TP_ARGS(mdsc, session, req, reason),
  76. TP_STRUCT__entry(
  77. __field(u64, tid)
  78. __field(int, op)
  79. __field(int, mds)
  80. __field(enum ceph_mdsc_suspend_reason, reason)
  81. ),
  82. TP_fast_assign(
  83. __entry->tid = req->r_tid;
  84. __entry->op = req->r_op;
  85. __entry->mds = session ? session->s_mds : -1;
  86. __entry->reason = reason;
  87. ),
  88. TP_printk("R=%llu op=%s reason=%s",
  89. __entry->tid,
  90. ceph_mds_op_name(__entry->op),
  91. __print_symbolic(__entry->reason, ceph_mdsc_suspend_reasons))
  92. );
  93. TRACE_EVENT(ceph_mdsc_resume_request,
  94. TP_PROTO(struct ceph_mds_client *mdsc,
  95. struct ceph_mds_request *req),
  96. TP_ARGS(mdsc, req),
  97. TP_STRUCT__entry(
  98. __field(u64, tid)
  99. __field(int, op)
  100. ),
  101. TP_fast_assign(
  102. __entry->tid = req->r_tid;
  103. __entry->op = req->r_op;
  104. ),
  105. TP_printk("R=%llu op=%s",
  106. __entry->tid,
  107. ceph_mds_op_name(__entry->op))
  108. );
  109. TRACE_EVENT(ceph_mdsc_send_request,
  110. TP_PROTO(struct ceph_mds_session *session,
  111. struct ceph_mds_request *req),
  112. TP_ARGS(session, req),
  113. TP_STRUCT__entry(
  114. __field(u64, tid)
  115. __field(int, op)
  116. __field(int, mds)
  117. ),
  118. TP_fast_assign(
  119. __entry->tid = req->r_tid;
  120. __entry->op = req->r_op;
  121. __entry->mds = session->s_mds;
  122. ),
  123. TP_printk("R=%llu op=%s mds=%d",
  124. __entry->tid,
  125. ceph_mds_op_name(__entry->op),
  126. __entry->mds)
  127. );
  128. TRACE_EVENT(ceph_mdsc_complete_request,
  129. TP_PROTO(struct ceph_mds_client *mdsc,
  130. struct ceph_mds_request *req),
  131. TP_ARGS(mdsc, req),
  132. TP_STRUCT__entry(
  133. __field(u64, tid)
  134. __field(int, op)
  135. __field(int, err)
  136. __field(unsigned long, latency_ns)
  137. ),
  138. TP_fast_assign(
  139. __entry->tid = req->r_tid;
  140. __entry->op = req->r_op;
  141. __entry->err = req->r_err;
  142. __entry->latency_ns = req->r_end_latency - req->r_start_latency;
  143. ),
  144. TP_printk("R=%llu op=%s err=%d latency_ns=%lu",
  145. __entry->tid,
  146. ceph_mds_op_name(__entry->op),
  147. __entry->err,
  148. __entry->latency_ns)
  149. );
  150. TRACE_EVENT(ceph_handle_caps,
  151. TP_PROTO(struct ceph_mds_client *mdsc,
  152. struct ceph_mds_session *session,
  153. int op,
  154. const struct ceph_vino *vino,
  155. struct ceph_inode_info *inode,
  156. u32 seq, u32 mseq, u32 issue_seq),
  157. TP_ARGS(mdsc, session, op, vino, inode, seq, mseq, issue_seq),
  158. TP_STRUCT__entry(
  159. __field(int, mds)
  160. __field(int, op)
  161. __field(u64, ino)
  162. __field(u64, snap)
  163. __field(u32, seq)
  164. __field(u32, mseq)
  165. __field(u32, issue_seq)
  166. ),
  167. TP_fast_assign(
  168. __entry->mds = session->s_mds;
  169. __entry->op = op;
  170. __entry->ino = vino->ino;
  171. __entry->snap = vino->snap;
  172. __entry->seq = seq;
  173. __entry->mseq = mseq;
  174. __entry->issue_seq = issue_seq;
  175. ),
  176. TP_printk("mds=%d op=%s vino=%llx.%llx seq=%u iseq=%u mseq=%u",
  177. __entry->mds,
  178. ceph_cap_op_name(__entry->op),
  179. __entry->ino,
  180. __entry->snap,
  181. __entry->seq,
  182. __entry->issue_seq,
  183. __entry->mseq)
  184. );
  185. #undef EM
  186. #undef E_
  187. #endif /* _TRACE_CEPH_H */
  188. /* This part must be outside protection */
  189. #include <trace/define_trace.h>