trace.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (c) 2014 Christoph Hellwig.
  4. */
  5. #undef TRACE_SYSTEM
  6. #define TRACE_SYSTEM nfsd
  7. #if !defined(_NFSD_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
  8. #define _NFSD_TRACE_H
  9. #include <linux/tracepoint.h>
  10. #include "nfsfh.h"
  11. TRACE_EVENT(nfsd_compound,
  12. TP_PROTO(const struct svc_rqst *rqst,
  13. u32 args_opcnt),
  14. TP_ARGS(rqst, args_opcnt),
  15. TP_STRUCT__entry(
  16. __field(u32, xid)
  17. __field(u32, args_opcnt)
  18. ),
  19. TP_fast_assign(
  20. __entry->xid = be32_to_cpu(rqst->rq_xid);
  21. __entry->args_opcnt = args_opcnt;
  22. ),
  23. TP_printk("xid=0x%08x opcnt=%u",
  24. __entry->xid, __entry->args_opcnt)
  25. )
  26. TRACE_EVENT(nfsd_compound_status,
  27. TP_PROTO(u32 args_opcnt,
  28. u32 resp_opcnt,
  29. __be32 status,
  30. const char *name),
  31. TP_ARGS(args_opcnt, resp_opcnt, status, name),
  32. TP_STRUCT__entry(
  33. __field(u32, args_opcnt)
  34. __field(u32, resp_opcnt)
  35. __field(int, status)
  36. __string(name, name)
  37. ),
  38. TP_fast_assign(
  39. __entry->args_opcnt = args_opcnt;
  40. __entry->resp_opcnt = resp_opcnt;
  41. __entry->status = be32_to_cpu(status);
  42. __assign_str(name, name);
  43. ),
  44. TP_printk("op=%u/%u %s status=%d",
  45. __entry->resp_opcnt, __entry->args_opcnt,
  46. __get_str(name), __entry->status)
  47. )
  48. DECLARE_EVENT_CLASS(nfsd_io_class,
  49. TP_PROTO(struct svc_rqst *rqstp,
  50. struct svc_fh *fhp,
  51. loff_t offset,
  52. unsigned long len),
  53. TP_ARGS(rqstp, fhp, offset, len),
  54. TP_STRUCT__entry(
  55. __field(u32, xid)
  56. __field(u32, fh_hash)
  57. __field(loff_t, offset)
  58. __field(unsigned long, len)
  59. ),
  60. TP_fast_assign(
  61. __entry->xid = be32_to_cpu(rqstp->rq_xid);
  62. __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
  63. __entry->offset = offset;
  64. __entry->len = len;
  65. ),
  66. TP_printk("xid=0x%08x fh_hash=0x%08x offset=%lld len=%lu",
  67. __entry->xid, __entry->fh_hash,
  68. __entry->offset, __entry->len)
  69. )
  70. #define DEFINE_NFSD_IO_EVENT(name) \
  71. DEFINE_EVENT(nfsd_io_class, nfsd_##name, \
  72. TP_PROTO(struct svc_rqst *rqstp, \
  73. struct svc_fh *fhp, \
  74. loff_t offset, \
  75. unsigned long len), \
  76. TP_ARGS(rqstp, fhp, offset, len))
  77. DEFINE_NFSD_IO_EVENT(read_start);
  78. DEFINE_NFSD_IO_EVENT(read_splice);
  79. DEFINE_NFSD_IO_EVENT(read_vector);
  80. DEFINE_NFSD_IO_EVENT(read_io_done);
  81. DEFINE_NFSD_IO_EVENT(read_done);
  82. DEFINE_NFSD_IO_EVENT(write_start);
  83. DEFINE_NFSD_IO_EVENT(write_opened);
  84. DEFINE_NFSD_IO_EVENT(write_io_done);
  85. DEFINE_NFSD_IO_EVENT(write_done);
  86. DECLARE_EVENT_CLASS(nfsd_err_class,
  87. TP_PROTO(struct svc_rqst *rqstp,
  88. struct svc_fh *fhp,
  89. loff_t offset,
  90. int status),
  91. TP_ARGS(rqstp, fhp, offset, status),
  92. TP_STRUCT__entry(
  93. __field(u32, xid)
  94. __field(u32, fh_hash)
  95. __field(loff_t, offset)
  96. __field(int, status)
  97. ),
  98. TP_fast_assign(
  99. __entry->xid = be32_to_cpu(rqstp->rq_xid);
  100. __entry->fh_hash = knfsd_fh_hash(&fhp->fh_handle);
  101. __entry->offset = offset;
  102. __entry->status = status;
  103. ),
  104. TP_printk("xid=0x%08x fh_hash=0x%08x offset=%lld status=%d",
  105. __entry->xid, __entry->fh_hash,
  106. __entry->offset, __entry->status)
  107. )
  108. #define DEFINE_NFSD_ERR_EVENT(name) \
  109. DEFINE_EVENT(nfsd_err_class, nfsd_##name, \
  110. TP_PROTO(struct svc_rqst *rqstp, \
  111. struct svc_fh *fhp, \
  112. loff_t offset, \
  113. int len), \
  114. TP_ARGS(rqstp, fhp, offset, len))
  115. DEFINE_NFSD_ERR_EVENT(read_err);
  116. DEFINE_NFSD_ERR_EVENT(write_err);
  117. #include "state.h"
  118. DECLARE_EVENT_CLASS(nfsd_stateid_class,
  119. TP_PROTO(stateid_t *stp),
  120. TP_ARGS(stp),
  121. TP_STRUCT__entry(
  122. __field(u32, cl_boot)
  123. __field(u32, cl_id)
  124. __field(u32, si_id)
  125. __field(u32, si_generation)
  126. ),
  127. TP_fast_assign(
  128. __entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
  129. __entry->cl_id = stp->si_opaque.so_clid.cl_id;
  130. __entry->si_id = stp->si_opaque.so_id;
  131. __entry->si_generation = stp->si_generation;
  132. ),
  133. TP_printk("client %08x:%08x stateid %08x:%08x",
  134. __entry->cl_boot,
  135. __entry->cl_id,
  136. __entry->si_id,
  137. __entry->si_generation)
  138. )
  139. #define DEFINE_STATEID_EVENT(name) \
  140. DEFINE_EVENT(nfsd_stateid_class, nfsd_##name, \
  141. TP_PROTO(stateid_t *stp), \
  142. TP_ARGS(stp))
  143. DEFINE_STATEID_EVENT(layoutstate_alloc);
  144. DEFINE_STATEID_EVENT(layoutstate_unhash);
  145. DEFINE_STATEID_EVENT(layoutstate_free);
  146. DEFINE_STATEID_EVENT(layout_get_lookup_fail);
  147. DEFINE_STATEID_EVENT(layout_commit_lookup_fail);
  148. DEFINE_STATEID_EVENT(layout_return_lookup_fail);
  149. DEFINE_STATEID_EVENT(layout_recall);
  150. DEFINE_STATEID_EVENT(layout_recall_done);
  151. DEFINE_STATEID_EVENT(layout_recall_fail);
  152. DEFINE_STATEID_EVENT(layout_recall_release);
  153. #endif /* _NFSD_TRACE_H */
  154. #undef TRACE_INCLUDE_PATH
  155. #define TRACE_INCLUDE_PATH .
  156. #define TRACE_INCLUDE_FILE trace
  157. #include <trace/define_trace.h>