1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM pblk
5 #if !defined(_TRACE_PBLK_H) || defined(TRACE_HEADER_MULTI_READ)
8 #include <linux/tracepoint.h>
12 #define show_chunk_flags(state) __print_flags(state, "", \
13 { NVM_CHK_ST_FREE, "FREE", }, \
14 { NVM_CHK_ST_CLOSED, "CLOSED", }, \
15 { NVM_CHK_ST_OPEN, "OPEN", }, \
16 { NVM_CHK_ST_OFFLINE, "OFFLINE", })
18 #define show_line_state(state) __print_symbolic(state, \
19 { PBLK_LINESTATE_NEW, "NEW", }, \
20 { PBLK_LINESTATE_FREE, "FREE", }, \
21 { PBLK_LINESTATE_OPEN, "OPEN", }, \
22 { PBLK_LINESTATE_CLOSED, "CLOSED", }, \
23 { PBLK_LINESTATE_GC, "GC", }, \
24 { PBLK_LINESTATE_BAD, "BAD", }, \
25 { PBLK_LINESTATE_CORRUPT, "CORRUPT" })
28 #define show_pblk_state(state) __print_symbolic(state, \
29 { PBLK_STATE_RUNNING, "RUNNING", }, \
30 { PBLK_STATE_STOPPING, "STOPPING", }, \
31 { PBLK_STATE_RECOVERING, "RECOVERING", }, \
32 { PBLK_STATE_STOPPED, "STOPPED" })
34 #define show_chunk_erase_state(state) __print_symbolic(state, \
35 { PBLK_CHUNK_RESET_START, "START", }, \
36 { PBLK_CHUNK_RESET_DONE, "OK", }, \
37 { PBLK_CHUNK_RESET_FAILED, "FAILED" })
40 TRACE_EVENT(pblk_chunk_reset
,
42 TP_PROTO(const char *name
, struct ppa_addr
*ppa
, int state
),
44 TP_ARGS(name
, ppa
, state
),
53 __assign_str(name
, name
);
54 __entry
->ppa
= ppa
->ppa
;
55 __entry
->state
= state
;
58 TP_printk("dev=%s grp=%llu pu=%llu chk=%llu state=%s", __get_str(name
),
59 (u64
)(((struct ppa_addr
*)(&__entry
->ppa
))->m
.grp
),
60 (u64
)(((struct ppa_addr
*)(&__entry
->ppa
))->m
.pu
),
61 (u64
)(((struct ppa_addr
*)(&__entry
->ppa
))->m
.chk
),
62 show_chunk_erase_state((int)__entry
->state
))
66 TRACE_EVENT(pblk_chunk_state
,
68 TP_PROTO(const char *name
, struct ppa_addr
*ppa
, int state
),
70 TP_ARGS(name
, ppa
, state
),
79 __assign_str(name
, name
);
80 __entry
->ppa
= ppa
->ppa
;
81 __entry
->state
= state
;
84 TP_printk("dev=%s grp=%llu pu=%llu chk=%llu state=%s", __get_str(name
),
85 (u64
)(((struct ppa_addr
*)(&__entry
->ppa
))->m
.grp
),
86 (u64
)(((struct ppa_addr
*)(&__entry
->ppa
))->m
.pu
),
87 (u64
)(((struct ppa_addr
*)(&__entry
->ppa
))->m
.chk
),
88 show_chunk_flags((int)__entry
->state
))
92 TRACE_EVENT(pblk_line_state
,
94 TP_PROTO(const char *name
, int line
, int state
),
96 TP_ARGS(name
, line
, state
),
105 __assign_str(name
, name
);
106 __entry
->line
= line
;
107 __entry
->state
= state
;
110 TP_printk("dev=%s line=%d state=%s", __get_str(name
),
112 show_line_state((int)__entry
->state
))
116 TRACE_EVENT(pblk_state
,
118 TP_PROTO(const char *name
, int state
),
120 TP_ARGS(name
, state
),
128 __assign_str(name
, name
);
129 __entry
->state
= state
;
132 TP_printk("dev=%s state=%s", __get_str(name
),
133 show_pblk_state((int)__entry
->state
))
137 #endif /* !defined(_TRACE_PBLK_H) || defined(TRACE_HEADER_MULTI_READ) */
139 /* This part must be outside protection */
141 #undef TRACE_INCLUDE_PATH
142 #define TRACE_INCLUDE_PATH ../../drivers/lightnvm
143 #undef TRACE_INCLUDE_FILE
144 #define TRACE_INCLUDE_FILE pblk-trace
145 #include <trace/define_trace.h>