pblk-trace.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #undef TRACE_SYSTEM
  3. #define TRACE_SYSTEM pblk
  4. #if !defined(_TRACE_PBLK_H) || defined(TRACE_HEADER_MULTI_READ)
  5. #define _TRACE_PBLK_H
  6. #include <linux/tracepoint.h>
  7. struct ppa_addr;
  8. #define show_chunk_flags(state) __print_flags(state, "", \
  9. { NVM_CHK_ST_FREE, "FREE", }, \
  10. { NVM_CHK_ST_CLOSED, "CLOSED", }, \
  11. { NVM_CHK_ST_OPEN, "OPEN", }, \
  12. { NVM_CHK_ST_OFFLINE, "OFFLINE", })
  13. #define show_line_state(state) __print_symbolic(state, \
  14. { PBLK_LINESTATE_NEW, "NEW", }, \
  15. { PBLK_LINESTATE_FREE, "FREE", }, \
  16. { PBLK_LINESTATE_OPEN, "OPEN", }, \
  17. { PBLK_LINESTATE_CLOSED, "CLOSED", }, \
  18. { PBLK_LINESTATE_GC, "GC", }, \
  19. { PBLK_LINESTATE_BAD, "BAD", }, \
  20. { PBLK_LINESTATE_CORRUPT, "CORRUPT" })
  21. #define show_pblk_state(state) __print_symbolic(state, \
  22. { PBLK_STATE_RUNNING, "RUNNING", }, \
  23. { PBLK_STATE_STOPPING, "STOPPING", }, \
  24. { PBLK_STATE_RECOVERING, "RECOVERING", }, \
  25. { PBLK_STATE_STOPPED, "STOPPED" })
  26. #define show_chunk_erase_state(state) __print_symbolic(state, \
  27. { PBLK_CHUNK_RESET_START, "START", }, \
  28. { PBLK_CHUNK_RESET_DONE, "OK", }, \
  29. { PBLK_CHUNK_RESET_FAILED, "FAILED" })
  30. TRACE_EVENT(pblk_chunk_reset,
  31. TP_PROTO(const char *name, struct ppa_addr *ppa, int state),
  32. TP_ARGS(name, ppa, state),
  33. TP_STRUCT__entry(
  34. __string(name, name)
  35. __field(u64, ppa)
  36. __field(int, state);
  37. ),
  38. TP_fast_assign(
  39. __assign_str(name, name);
  40. __entry->ppa = ppa->ppa;
  41. __entry->state = state;
  42. ),
  43. TP_printk("dev=%s grp=%llu pu=%llu chk=%llu state=%s", __get_str(name),
  44. (u64)(((struct ppa_addr *)(&__entry->ppa))->m.grp),
  45. (u64)(((struct ppa_addr *)(&__entry->ppa))->m.pu),
  46. (u64)(((struct ppa_addr *)(&__entry->ppa))->m.chk),
  47. show_chunk_erase_state((int)__entry->state))
  48. );
  49. TRACE_EVENT(pblk_chunk_state,
  50. TP_PROTO(const char *name, struct ppa_addr *ppa, int state),
  51. TP_ARGS(name, ppa, state),
  52. TP_STRUCT__entry(
  53. __string(name, name)
  54. __field(u64, ppa)
  55. __field(int, state);
  56. ),
  57. TP_fast_assign(
  58. __assign_str(name, name);
  59. __entry->ppa = ppa->ppa;
  60. __entry->state = state;
  61. ),
  62. TP_printk("dev=%s grp=%llu pu=%llu chk=%llu state=%s", __get_str(name),
  63. (u64)(((struct ppa_addr *)(&__entry->ppa))->m.grp),
  64. (u64)(((struct ppa_addr *)(&__entry->ppa))->m.pu),
  65. (u64)(((struct ppa_addr *)(&__entry->ppa))->m.chk),
  66. show_chunk_flags((int)__entry->state))
  67. );
  68. TRACE_EVENT(pblk_line_state,
  69. TP_PROTO(const char *name, int line, int state),
  70. TP_ARGS(name, line, state),
  71. TP_STRUCT__entry(
  72. __string(name, name)
  73. __field(int, line)
  74. __field(int, state);
  75. ),
  76. TP_fast_assign(
  77. __assign_str(name, name);
  78. __entry->line = line;
  79. __entry->state = state;
  80. ),
  81. TP_printk("dev=%s line=%d state=%s", __get_str(name),
  82. (int)__entry->line,
  83. show_line_state((int)__entry->state))
  84. );
  85. TRACE_EVENT(pblk_state,
  86. TP_PROTO(const char *name, int state),
  87. TP_ARGS(name, state),
  88. TP_STRUCT__entry(
  89. __string(name, name)
  90. __field(int, state);
  91. ),
  92. TP_fast_assign(
  93. __assign_str(name, name);
  94. __entry->state = state;
  95. ),
  96. TP_printk("dev=%s state=%s", __get_str(name),
  97. show_pblk_state((int)__entry->state))
  98. );
  99. #endif /* !defined(_TRACE_PBLK_H) || defined(TRACE_HEADER_MULTI_READ) */
  100. /* This part must be outside protection */
  101. #undef TRACE_INCLUDE_PATH
  102. #define TRACE_INCLUDE_PATH ../../drivers/lightnvm
  103. #undef TRACE_INCLUDE_FILE
  104. #define TRACE_INCLUDE_FILE pblk-trace
  105. #include <trace/define_trace.h>