Skip to content

Commit 13871ba

Browse files
committed
1 parent fe2140e commit 13871ba

File tree

1 file changed

+176
-0
lines changed

1 file changed

+176
-0
lines changed

include/trace/events/cachefiles.h

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,21 @@
1818
#ifndef __CACHEFILES_DECLARE_TRACE_ENUMS_ONCE_ONLY
1919
#define __CACHEFILES_DECLARE_TRACE_ENUMS_ONCE_ONLY
2020

21+
enum fscache_why_object_killed {
22+
FSCACHE_OBJECT_IS_STALE,
23+
FSCACHE_OBJECT_IS_WEIRD,
24+
FSCACHE_OBJECT_INVALIDATED,
25+
FSCACHE_OBJECT_NO_SPACE,
26+
FSCACHE_OBJECT_WAS_RETIRED,
27+
FSCACHE_OBJECT_WAS_CULLED,
28+
};
29+
30+
enum cachefiles_trunc_trace {
31+
cachefiles_trunc_dio_adjust,
32+
cachefiles_trunc_expand_tmpfile,
33+
cachefiles_trunc_shrink,
34+
};
35+
2136
enum cachefiles_error_trace {
2237
cachefiles_trace_fallocate_error,
2338
cachefiles_trace_getxattr_error,
@@ -43,6 +58,19 @@ enum cachefiles_error_trace {
4358
/*
4459
* Define enum -> string mappings for display.
4560
*/
61+
#define cachefiles_obj_kill_traces \
62+
EM(FSCACHE_OBJECT_IS_STALE, "stale") \
63+
EM(FSCACHE_OBJECT_IS_WEIRD, "weird") \
64+
EM(FSCACHE_OBJECT_INVALIDATED, "inval") \
65+
EM(FSCACHE_OBJECT_NO_SPACE, "no_space") \
66+
EM(FSCACHE_OBJECT_WAS_RETIRED, "was_retired") \
67+
E_(FSCACHE_OBJECT_WAS_CULLED, "was_culled")
68+
69+
#define cachefiles_trunc_traces \
70+
EM(cachefiles_trunc_dio_adjust, "DIOADJ") \
71+
EM(cachefiles_trunc_expand_tmpfile, "EXPTMP") \
72+
E_(cachefiles_trunc_shrink, "SHRINK")
73+
4674
#define cachefiles_error_traces \
4775
EM(cachefiles_trace_fallocate_error, "fallocate") \
4876
EM(cachefiles_trace_getxattr_error, "getxattr") \
@@ -71,6 +99,8 @@ enum cachefiles_error_trace {
7199
#define EM(a, b) TRACE_DEFINE_ENUM(a);
72100
#define E_(a, b) TRACE_DEFINE_ENUM(a);
73101

102+
cachefiles_obj_kill_traces;
103+
cachefiles_trunc_traces;
74104
cachefiles_error_traces;
75105

76106
/*
@@ -83,6 +113,152 @@ cachefiles_error_traces;
83113
#define E_(a, b) { a, b }
84114

85115

116+
TRACE_EVENT(cachefiles_lookup,
117+
TP_PROTO(struct cachefiles_object *obj,
118+
struct dentry *de),
119+
120+
TP_ARGS(obj, de),
121+
122+
TP_STRUCT__entry(
123+
__field(unsigned int, obj )
124+
__field(short, error )
125+
__field(unsigned long, ino )
126+
),
127+
128+
TP_fast_assign(
129+
__entry->obj = obj->debug_id;
130+
__entry->ino = (!IS_ERR(de) && d_backing_inode(de) ?
131+
d_backing_inode(de)->i_ino : 0);
132+
__entry->error = IS_ERR(de) ? PTR_ERR(de) : 0;
133+
),
134+
135+
TP_printk("o=%08x i=%lx e=%d",
136+
__entry->obj, __entry->ino, __entry->error)
137+
);
138+
139+
TRACE_EVENT(cachefiles_tmpfile,
140+
TP_PROTO(struct cachefiles_object *obj, struct inode *backer),
141+
142+
TP_ARGS(obj, backer),
143+
144+
TP_STRUCT__entry(
145+
__field(unsigned int, obj )
146+
__field(unsigned int, backer )
147+
),
148+
149+
TP_fast_assign(
150+
__entry->obj = obj->debug_id;
151+
__entry->backer = backer->i_ino;
152+
),
153+
154+
TP_printk("o=%08x b=%08x",
155+
__entry->obj,
156+
__entry->backer)
157+
);
158+
159+
TRACE_EVENT(cachefiles_link,
160+
TP_PROTO(struct cachefiles_object *obj, struct inode *backer),
161+
162+
TP_ARGS(obj, backer),
163+
164+
TP_STRUCT__entry(
165+
__field(unsigned int, obj )
166+
__field(unsigned int, backer )
167+
),
168+
169+
TP_fast_assign(
170+
__entry->obj = obj->debug_id;
171+
__entry->backer = backer->i_ino;
172+
),
173+
174+
TP_printk("o=%08x b=%08x",
175+
__entry->obj,
176+
__entry->backer)
177+
);
178+
179+
TRACE_EVENT(cachefiles_unlink,
180+
TP_PROTO(struct cachefiles_object *obj,
181+
struct dentry *de,
182+
enum fscache_why_object_killed why),
183+
184+
TP_ARGS(obj, de, why),
185+
186+
/* Note that obj may be NULL */
187+
TP_STRUCT__entry(
188+
__field(unsigned int, obj )
189+
__field(struct dentry *, de )
190+
__field(enum fscache_why_object_killed, why )
191+
),
192+
193+
TP_fast_assign(
194+
__entry->obj = obj ? obj->debug_id : UINT_MAX;
195+
__entry->de = de;
196+
__entry->why = why;
197+
),
198+
199+
TP_printk("o=%08x d=%p w=%s",
200+
__entry->obj, __entry->de,
201+
__print_symbolic(__entry->why, cachefiles_obj_kill_traces))
202+
);
203+
204+
TRACE_EVENT(cachefiles_rename,
205+
TP_PROTO(struct cachefiles_object *obj,
206+
struct dentry *de,
207+
struct dentry *to,
208+
enum fscache_why_object_killed why),
209+
210+
TP_ARGS(obj, de, to, why),
211+
212+
/* Note that obj may be NULL */
213+
TP_STRUCT__entry(
214+
__field(unsigned int, obj )
215+
__field(struct dentry *, de )
216+
__field(struct dentry *, to )
217+
__field(enum fscache_why_object_killed, why )
218+
),
219+
220+
TP_fast_assign(
221+
__entry->obj = obj ? obj->debug_id : UINT_MAX;
222+
__entry->de = de;
223+
__entry->to = to;
224+
__entry->why = why;
225+
),
226+
227+
TP_printk("o=%08x d=%p t=%p w=%s",
228+
__entry->obj, __entry->de, __entry->to,
229+
__print_symbolic(__entry->why, cachefiles_obj_kill_traces))
230+
);
231+
232+
TRACE_EVENT(cachefiles_trunc,
233+
TP_PROTO(struct cachefiles_object *obj, struct inode *backer,
234+
loff_t from, loff_t to, enum cachefiles_trunc_trace why),
235+
236+
TP_ARGS(obj, backer, from, to, why),
237+
238+
TP_STRUCT__entry(
239+
__field(unsigned int, obj )
240+
__field(unsigned int, backer )
241+
__field(enum cachefiles_trunc_trace, why )
242+
__field(loff_t, from )
243+
__field(loff_t, to )
244+
),
245+
246+
TP_fast_assign(
247+
__entry->obj = obj->debug_id;
248+
__entry->backer = backer->i_ino;
249+
__entry->from = from;
250+
__entry->to = to;
251+
__entry->why = why;
252+
),
253+
254+
TP_printk("o=%08x b=%08x %s l=%llx->%llx",
255+
__entry->obj,
256+
__entry->backer,
257+
__print_symbolic(__entry->why, cachefiles_trunc_traces),
258+
__entry->from,
259+
__entry->to)
260+
);
261+
86262
TRACE_EVENT(cachefiles_mark_active,
87263
TP_PROTO(struct cachefiles_object *obj,
88264
struct inode *inode),

0 commit comments

Comments
 (0)