• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #undef TRACE_SYSTEM
3 #define TRACE_SYSTEM pblk
4 
5 #if !defined(_TRACE_PBLK_H) || defined(TRACE_HEADER_MULTI_READ)
6 #define _TRACE_PBLK_H
7 
8 #include <linux/tracepoint.h>
9 
10 struct ppa_addr;
11 
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",	})
17 
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"	})
26 
27 
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"	})
33 
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"	})
38 
39 
40 TRACE_EVENT(pblk_chunk_reset,
41 
42 	TP_PROTO(const char *name, struct ppa_addr *ppa, int state),
43 
44 	TP_ARGS(name, ppa, state),
45 
46 	TP_STRUCT__entry(
47 		__string(name, name)
48 		__field(u64, ppa)
49 		__field(int, state)
50 	),
51 
52 	TP_fast_assign(
53 		__assign_str(name, name);
54 		__entry->ppa = ppa->ppa;
55 		__entry->state = state;
56 	),
57 
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))
63 
64 );
65 
66 TRACE_EVENT(pblk_chunk_state,
67 
68 	TP_PROTO(const char *name, struct ppa_addr *ppa, int state),
69 
70 	TP_ARGS(name, ppa, state),
71 
72 	TP_STRUCT__entry(
73 		__string(name, name)
74 		__field(u64, ppa)
75 		__field(int, state)
76 	),
77 
78 	TP_fast_assign(
79 		__assign_str(name, name);
80 		__entry->ppa = ppa->ppa;
81 		__entry->state = state;
82 	),
83 
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))
89 
90 );
91 
92 TRACE_EVENT(pblk_line_state,
93 
94 	TP_PROTO(const char *name, int line, int state),
95 
96 	TP_ARGS(name, line, state),
97 
98 	TP_STRUCT__entry(
99 		__string(name, name)
100 		__field(int, line)
101 		__field(int, state)
102 	),
103 
104 	TP_fast_assign(
105 		__assign_str(name, name);
106 		__entry->line = line;
107 		__entry->state = state;
108 	),
109 
110 	TP_printk("dev=%s line=%d state=%s", __get_str(name),
111 			(int)__entry->line,
112 			show_line_state((int)__entry->state))
113 
114 );
115 
116 TRACE_EVENT(pblk_state,
117 
118 	TP_PROTO(const char *name, int state),
119 
120 	TP_ARGS(name, state),
121 
122 	TP_STRUCT__entry(
123 		__string(name, name)
124 		__field(int, state)
125 	),
126 
127 	TP_fast_assign(
128 		__assign_str(name, name);
129 		__entry->state = state;
130 	),
131 
132 	TP_printk("dev=%s state=%s", __get_str(name),
133 			show_pblk_state((int)__entry->state))
134 
135 );
136 
137 #endif /* !defined(_TRACE_PBLK_H) || defined(TRACE_HEADER_MULTI_READ) */
138 
139 /* This part must be outside protection */
140 
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>
146