David Howells | 77443f6 | 2021-11-26 14:32:29 +0000 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
| 2 | /* CacheFiles tracepoints |
| 3 | * |
| 4 | * Copyright (C) 2021 Red Hat, Inc. All Rights Reserved. |
| 5 | * Written by David Howells (dhowells@redhat.com) |
| 6 | */ |
| 7 | #undef TRACE_SYSTEM |
| 8 | #define TRACE_SYSTEM cachefiles |
| 9 | |
| 10 | #if !defined(_TRACE_CACHEFILES_H) || defined(TRACE_HEADER_MULTI_READ) |
| 11 | #define _TRACE_CACHEFILES_H |
| 12 | |
| 13 | #include <linux/tracepoint.h> |
| 14 | |
| 15 | /* |
| 16 | * Define enums for tracing information. |
| 17 | */ |
| 18 | #ifndef __CACHEFILES_DECLARE_TRACE_ENUMS_ONCE_ONLY |
| 19 | #define __CACHEFILES_DECLARE_TRACE_ENUMS_ONCE_ONLY |
| 20 | |
David Howells | df98e87 | 2021-11-17 16:22:21 +0000 | [diff] [blame] | 21 | enum cachefiles_obj_ref_trace { |
| 22 | cachefiles_obj_get_ioreq, |
| 23 | cachefiles_obj_new, |
| 24 | cachefiles_obj_put_alloc_fail, |
| 25 | cachefiles_obj_put_detach, |
| 26 | cachefiles_obj_put_ioreq, |
| 27 | cachefiles_obj_see_clean_commit, |
| 28 | cachefiles_obj_see_clean_delete, |
| 29 | cachefiles_obj_see_clean_drop_tmp, |
| 30 | cachefiles_obj_see_lookup_cookie, |
| 31 | cachefiles_obj_see_lookup_failed, |
| 32 | cachefiles_obj_see_withdraw_cookie, |
| 33 | cachefiles_obj_see_withdrawal, |
| 34 | }; |
| 35 | |
David Howells | 13871ba | 2021-11-16 16:30:25 +0000 | [diff] [blame] | 36 | enum fscache_why_object_killed { |
| 37 | FSCACHE_OBJECT_IS_STALE, |
| 38 | FSCACHE_OBJECT_IS_WEIRD, |
| 39 | FSCACHE_OBJECT_INVALIDATED, |
| 40 | FSCACHE_OBJECT_NO_SPACE, |
| 41 | FSCACHE_OBJECT_WAS_RETIRED, |
| 42 | FSCACHE_OBJECT_WAS_CULLED, |
David Howells | 32e1500 | 2021-12-14 09:51:43 +0000 | [diff] [blame] | 43 | FSCACHE_VOLUME_IS_WEIRD, |
David Howells | 13871ba | 2021-11-16 16:30:25 +0000 | [diff] [blame] | 44 | }; |
| 45 | |
David Howells | 72b9578 | 2021-11-17 16:11:07 +0000 | [diff] [blame] | 46 | enum cachefiles_coherency_trace { |
| 47 | cachefiles_coherency_check_aux, |
| 48 | cachefiles_coherency_check_content, |
| 49 | cachefiles_coherency_check_dirty, |
| 50 | cachefiles_coherency_check_len, |
| 51 | cachefiles_coherency_check_objsize, |
| 52 | cachefiles_coherency_check_ok, |
| 53 | cachefiles_coherency_check_type, |
| 54 | cachefiles_coherency_check_xattr, |
| 55 | cachefiles_coherency_set_fail, |
| 56 | cachefiles_coherency_set_ok, |
David Howells | 32e1500 | 2021-12-14 09:51:43 +0000 | [diff] [blame] | 57 | cachefiles_coherency_vol_check_cmp, |
| 58 | cachefiles_coherency_vol_check_ok, |
| 59 | cachefiles_coherency_vol_check_xattr, |
| 60 | cachefiles_coherency_vol_set_fail, |
| 61 | cachefiles_coherency_vol_set_ok, |
David Howells | 72b9578 | 2021-11-17 16:11:07 +0000 | [diff] [blame] | 62 | }; |
| 63 | |
David Howells | 13871ba | 2021-11-16 16:30:25 +0000 | [diff] [blame] | 64 | enum cachefiles_trunc_trace { |
| 65 | cachefiles_trunc_dio_adjust, |
| 66 | cachefiles_trunc_expand_tmpfile, |
| 67 | cachefiles_trunc_shrink, |
| 68 | }; |
| 69 | |
David Howells | 047487c | 2021-10-21 00:19:46 +0100 | [diff] [blame] | 70 | enum cachefiles_prepare_read_trace { |
| 71 | cachefiles_trace_read_after_eof, |
| 72 | cachefiles_trace_read_found_hole, |
| 73 | cachefiles_trace_read_found_part, |
| 74 | cachefiles_trace_read_have_data, |
| 75 | cachefiles_trace_read_no_data, |
| 76 | cachefiles_trace_read_no_file, |
| 77 | cachefiles_trace_read_seek_error, |
| 78 | cachefiles_trace_read_seek_nxio, |
| 79 | }; |
| 80 | |
David Howells | ecf5a6c | 2021-10-21 08:42:18 +0100 | [diff] [blame] | 81 | enum cachefiles_error_trace { |
| 82 | cachefiles_trace_fallocate_error, |
| 83 | cachefiles_trace_getxattr_error, |
| 84 | cachefiles_trace_link_error, |
| 85 | cachefiles_trace_lookup_error, |
| 86 | cachefiles_trace_mkdir_error, |
| 87 | cachefiles_trace_notify_change_error, |
| 88 | cachefiles_trace_open_error, |
| 89 | cachefiles_trace_read_error, |
| 90 | cachefiles_trace_remxattr_error, |
| 91 | cachefiles_trace_rename_error, |
| 92 | cachefiles_trace_seek_error, |
| 93 | cachefiles_trace_setxattr_error, |
| 94 | cachefiles_trace_statfs_error, |
| 95 | cachefiles_trace_tmpfile_error, |
| 96 | cachefiles_trace_trunc_error, |
| 97 | cachefiles_trace_unlink_error, |
| 98 | cachefiles_trace_write_error, |
| 99 | }; |
| 100 | |
David Howells | 77443f6 | 2021-11-26 14:32:29 +0000 | [diff] [blame] | 101 | #endif |
| 102 | |
| 103 | /* |
| 104 | * Define enum -> string mappings for display. |
| 105 | */ |
David Howells | 13871ba | 2021-11-16 16:30:25 +0000 | [diff] [blame] | 106 | #define cachefiles_obj_kill_traces \ |
| 107 | EM(FSCACHE_OBJECT_IS_STALE, "stale") \ |
| 108 | EM(FSCACHE_OBJECT_IS_WEIRD, "weird") \ |
| 109 | EM(FSCACHE_OBJECT_INVALIDATED, "inval") \ |
| 110 | EM(FSCACHE_OBJECT_NO_SPACE, "no_space") \ |
| 111 | EM(FSCACHE_OBJECT_WAS_RETIRED, "was_retired") \ |
David Howells | 32e1500 | 2021-12-14 09:51:43 +0000 | [diff] [blame] | 112 | EM(FSCACHE_OBJECT_WAS_CULLED, "was_culled") \ |
| 113 | E_(FSCACHE_VOLUME_IS_WEIRD, "volume_weird") |
David Howells | 13871ba | 2021-11-16 16:30:25 +0000 | [diff] [blame] | 114 | |
David Howells | df98e87 | 2021-11-17 16:22:21 +0000 | [diff] [blame] | 115 | #define cachefiles_obj_ref_traces \ |
| 116 | EM(cachefiles_obj_get_ioreq, "GET ioreq") \ |
| 117 | EM(cachefiles_obj_new, "NEW obj") \ |
| 118 | EM(cachefiles_obj_put_alloc_fail, "PUT alloc_fail") \ |
| 119 | EM(cachefiles_obj_put_detach, "PUT detach") \ |
| 120 | EM(cachefiles_obj_put_ioreq, "PUT ioreq") \ |
| 121 | EM(cachefiles_obj_see_clean_commit, "SEE clean_commit") \ |
| 122 | EM(cachefiles_obj_see_clean_delete, "SEE clean_delete") \ |
| 123 | EM(cachefiles_obj_see_clean_drop_tmp, "SEE clean_drop_tmp") \ |
| 124 | EM(cachefiles_obj_see_lookup_cookie, "SEE lookup_cookie") \ |
| 125 | EM(cachefiles_obj_see_lookup_failed, "SEE lookup_failed") \ |
| 126 | EM(cachefiles_obj_see_withdraw_cookie, "SEE withdraw_cookie") \ |
| 127 | E_(cachefiles_obj_see_withdrawal, "SEE withdrawal") |
| 128 | |
David Howells | 72b9578 | 2021-11-17 16:11:07 +0000 | [diff] [blame] | 129 | #define cachefiles_coherency_traces \ |
| 130 | EM(cachefiles_coherency_check_aux, "BAD aux ") \ |
| 131 | EM(cachefiles_coherency_check_content, "BAD cont") \ |
| 132 | EM(cachefiles_coherency_check_dirty, "BAD dirt") \ |
| 133 | EM(cachefiles_coherency_check_len, "BAD len ") \ |
| 134 | EM(cachefiles_coherency_check_objsize, "BAD osiz") \ |
| 135 | EM(cachefiles_coherency_check_ok, "OK ") \ |
| 136 | EM(cachefiles_coherency_check_type, "BAD type") \ |
| 137 | EM(cachefiles_coherency_check_xattr, "BAD xatt") \ |
| 138 | EM(cachefiles_coherency_set_fail, "SET fail") \ |
David Howells | 32e1500 | 2021-12-14 09:51:43 +0000 | [diff] [blame] | 139 | EM(cachefiles_coherency_set_ok, "SET ok ") \ |
| 140 | EM(cachefiles_coherency_vol_check_cmp, "VOL BAD cmp ") \ |
| 141 | EM(cachefiles_coherency_vol_check_ok, "VOL OK ") \ |
| 142 | EM(cachefiles_coherency_vol_check_xattr,"VOL BAD xatt") \ |
| 143 | EM(cachefiles_coherency_vol_set_fail, "VOL SET fail") \ |
| 144 | E_(cachefiles_coherency_vol_set_ok, "VOL SET ok ") |
David Howells | 72b9578 | 2021-11-17 16:11:07 +0000 | [diff] [blame] | 145 | |
David Howells | 13871ba | 2021-11-16 16:30:25 +0000 | [diff] [blame] | 146 | #define cachefiles_trunc_traces \ |
| 147 | EM(cachefiles_trunc_dio_adjust, "DIOADJ") \ |
| 148 | EM(cachefiles_trunc_expand_tmpfile, "EXPTMP") \ |
| 149 | E_(cachefiles_trunc_shrink, "SHRINK") |
| 150 | |
David Howells | 047487c | 2021-10-21 00:19:46 +0100 | [diff] [blame] | 151 | #define cachefiles_prepare_read_traces \ |
| 152 | EM(cachefiles_trace_read_after_eof, "after-eof ") \ |
| 153 | EM(cachefiles_trace_read_found_hole, "found-hole") \ |
| 154 | EM(cachefiles_trace_read_found_part, "found-part") \ |
| 155 | EM(cachefiles_trace_read_have_data, "have-data ") \ |
| 156 | EM(cachefiles_trace_read_no_data, "no-data ") \ |
| 157 | EM(cachefiles_trace_read_no_file, "no-file ") \ |
| 158 | EM(cachefiles_trace_read_seek_error, "seek-error") \ |
| 159 | E_(cachefiles_trace_read_seek_nxio, "seek-enxio") |
| 160 | |
David Howells | ecf5a6c | 2021-10-21 08:42:18 +0100 | [diff] [blame] | 161 | #define cachefiles_error_traces \ |
| 162 | EM(cachefiles_trace_fallocate_error, "fallocate") \ |
| 163 | EM(cachefiles_trace_getxattr_error, "getxattr") \ |
| 164 | EM(cachefiles_trace_link_error, "link") \ |
| 165 | EM(cachefiles_trace_lookup_error, "lookup") \ |
| 166 | EM(cachefiles_trace_mkdir_error, "mkdir") \ |
| 167 | EM(cachefiles_trace_notify_change_error, "notify_change") \ |
| 168 | EM(cachefiles_trace_open_error, "open") \ |
| 169 | EM(cachefiles_trace_read_error, "read") \ |
| 170 | EM(cachefiles_trace_remxattr_error, "remxattr") \ |
| 171 | EM(cachefiles_trace_rename_error, "rename") \ |
| 172 | EM(cachefiles_trace_seek_error, "seek") \ |
| 173 | EM(cachefiles_trace_setxattr_error, "setxattr") \ |
| 174 | EM(cachefiles_trace_statfs_error, "statfs") \ |
| 175 | EM(cachefiles_trace_tmpfile_error, "tmpfile") \ |
| 176 | EM(cachefiles_trace_trunc_error, "trunc") \ |
| 177 | EM(cachefiles_trace_unlink_error, "unlink") \ |
| 178 | E_(cachefiles_trace_write_error, "write") |
David Howells | 77443f6 | 2021-11-26 14:32:29 +0000 | [diff] [blame] | 179 | |
| 180 | |
| 181 | /* |
| 182 | * Export enum symbols via userspace. |
| 183 | */ |
| 184 | #undef EM |
| 185 | #undef E_ |
| 186 | #define EM(a, b) TRACE_DEFINE_ENUM(a); |
| 187 | #define E_(a, b) TRACE_DEFINE_ENUM(a); |
| 188 | |
David Howells | 13871ba | 2021-11-16 16:30:25 +0000 | [diff] [blame] | 189 | cachefiles_obj_kill_traces; |
David Howells | df98e87 | 2021-11-17 16:22:21 +0000 | [diff] [blame] | 190 | cachefiles_obj_ref_traces; |
David Howells | 72b9578 | 2021-11-17 16:11:07 +0000 | [diff] [blame] | 191 | cachefiles_coherency_traces; |
David Howells | 13871ba | 2021-11-16 16:30:25 +0000 | [diff] [blame] | 192 | cachefiles_trunc_traces; |
David Howells | 047487c | 2021-10-21 00:19:46 +0100 | [diff] [blame] | 193 | cachefiles_prepare_read_traces; |
David Howells | ecf5a6c | 2021-10-21 08:42:18 +0100 | [diff] [blame] | 194 | cachefiles_error_traces; |
| 195 | |
David Howells | 77443f6 | 2021-11-26 14:32:29 +0000 | [diff] [blame] | 196 | /* |
| 197 | * Now redefine the EM() and E_() macros to map the enums to the strings that |
| 198 | * will be printed in the output. |
| 199 | */ |
| 200 | #undef EM |
| 201 | #undef E_ |
| 202 | #define EM(a, b) { a, b }, |
| 203 | #define E_(a, b) { a, b } |
| 204 | |
| 205 | |
David Howells | df98e87 | 2021-11-17 16:22:21 +0000 | [diff] [blame] | 206 | TRACE_EVENT(cachefiles_ref, |
| 207 | TP_PROTO(unsigned int object_debug_id, |
| 208 | unsigned int cookie_debug_id, |
| 209 | int usage, |
| 210 | enum cachefiles_obj_ref_trace why), |
| 211 | |
| 212 | TP_ARGS(object_debug_id, cookie_debug_id, usage, why), |
| 213 | |
| 214 | /* Note that obj may be NULL */ |
| 215 | TP_STRUCT__entry( |
| 216 | __field(unsigned int, obj ) |
| 217 | __field(unsigned int, cookie ) |
| 218 | __field(enum cachefiles_obj_ref_trace, why ) |
| 219 | __field(int, usage ) |
| 220 | ), |
| 221 | |
| 222 | TP_fast_assign( |
| 223 | __entry->obj = object_debug_id; |
| 224 | __entry->cookie = cookie_debug_id; |
| 225 | __entry->usage = usage; |
| 226 | __entry->why = why; |
| 227 | ), |
| 228 | |
| 229 | TP_printk("c=%08x o=%08x u=%d %s", |
| 230 | __entry->cookie, __entry->obj, __entry->usage, |
| 231 | __print_symbolic(__entry->why, cachefiles_obj_ref_traces)) |
| 232 | ); |
| 233 | |
David Howells | 13871ba | 2021-11-16 16:30:25 +0000 | [diff] [blame] | 234 | TRACE_EVENT(cachefiles_lookup, |
| 235 | TP_PROTO(struct cachefiles_object *obj, |
David Howells | 8c39b8b | 2022-01-14 11:44:54 +0000 | [diff] [blame] | 236 | struct dentry *dir, |
David Howells | 13871ba | 2021-11-16 16:30:25 +0000 | [diff] [blame] | 237 | struct dentry *de), |
| 238 | |
David Howells | 8c39b8b | 2022-01-14 11:44:54 +0000 | [diff] [blame] | 239 | TP_ARGS(obj, dir, de), |
David Howells | 13871ba | 2021-11-16 16:30:25 +0000 | [diff] [blame] | 240 | |
| 241 | TP_STRUCT__entry( |
| 242 | __field(unsigned int, obj ) |
| 243 | __field(short, error ) |
David Howells | 8c39b8b | 2022-01-14 11:44:54 +0000 | [diff] [blame] | 244 | __field(unsigned long, dino ) |
David Howells | 13871ba | 2021-11-16 16:30:25 +0000 | [diff] [blame] | 245 | __field(unsigned long, ino ) |
| 246 | ), |
| 247 | |
| 248 | TP_fast_assign( |
David Howells | 8c39b8b | 2022-01-14 11:44:54 +0000 | [diff] [blame] | 249 | __entry->obj = obj ? obj->debug_id : 0; |
| 250 | __entry->dino = d_backing_inode(dir)->i_ino; |
David Howells | 13871ba | 2021-11-16 16:30:25 +0000 | [diff] [blame] | 251 | __entry->ino = (!IS_ERR(de) && d_backing_inode(de) ? |
| 252 | d_backing_inode(de)->i_ino : 0); |
| 253 | __entry->error = IS_ERR(de) ? PTR_ERR(de) : 0; |
| 254 | ), |
| 255 | |
David Howells | 8c39b8b | 2022-01-14 11:44:54 +0000 | [diff] [blame] | 256 | TP_printk("o=%08x dB=%lx B=%lx e=%d", |
| 257 | __entry->obj, __entry->dino, __entry->ino, __entry->error) |
| 258 | ); |
| 259 | |
| 260 | TRACE_EVENT(cachefiles_mkdir, |
| 261 | TP_PROTO(struct dentry *dir, struct dentry *subdir), |
| 262 | |
| 263 | TP_ARGS(dir, subdir), |
| 264 | |
| 265 | TP_STRUCT__entry( |
| 266 | __field(unsigned int, dir ) |
| 267 | __field(unsigned int, subdir ) |
| 268 | ), |
| 269 | |
| 270 | TP_fast_assign( |
| 271 | __entry->dir = d_backing_inode(dir)->i_ino; |
| 272 | __entry->subdir = d_backing_inode(subdir)->i_ino; |
| 273 | ), |
| 274 | |
| 275 | TP_printk("dB=%x sB=%x", |
| 276 | __entry->dir, |
| 277 | __entry->subdir) |
David Howells | 13871ba | 2021-11-16 16:30:25 +0000 | [diff] [blame] | 278 | ); |
| 279 | |
| 280 | TRACE_EVENT(cachefiles_tmpfile, |
| 281 | TP_PROTO(struct cachefiles_object *obj, struct inode *backer), |
| 282 | |
| 283 | TP_ARGS(obj, backer), |
| 284 | |
| 285 | TP_STRUCT__entry( |
| 286 | __field(unsigned int, obj ) |
| 287 | __field(unsigned int, backer ) |
| 288 | ), |
| 289 | |
| 290 | TP_fast_assign( |
| 291 | __entry->obj = obj->debug_id; |
| 292 | __entry->backer = backer->i_ino; |
| 293 | ), |
| 294 | |
David Howells | 8c39b8b | 2022-01-14 11:44:54 +0000 | [diff] [blame] | 295 | TP_printk("o=%08x B=%x", |
David Howells | 13871ba | 2021-11-16 16:30:25 +0000 | [diff] [blame] | 296 | __entry->obj, |
| 297 | __entry->backer) |
| 298 | ); |
| 299 | |
| 300 | TRACE_EVENT(cachefiles_link, |
| 301 | TP_PROTO(struct cachefiles_object *obj, struct inode *backer), |
| 302 | |
| 303 | TP_ARGS(obj, backer), |
| 304 | |
| 305 | TP_STRUCT__entry( |
| 306 | __field(unsigned int, obj ) |
| 307 | __field(unsigned int, backer ) |
| 308 | ), |
| 309 | |
| 310 | TP_fast_assign( |
| 311 | __entry->obj = obj->debug_id; |
| 312 | __entry->backer = backer->i_ino; |
| 313 | ), |
| 314 | |
David Howells | 8c39b8b | 2022-01-14 11:44:54 +0000 | [diff] [blame] | 315 | TP_printk("o=%08x B=%x", |
David Howells | 13871ba | 2021-11-16 16:30:25 +0000 | [diff] [blame] | 316 | __entry->obj, |
| 317 | __entry->backer) |
| 318 | ); |
| 319 | |
| 320 | TRACE_EVENT(cachefiles_unlink, |
| 321 | TP_PROTO(struct cachefiles_object *obj, |
David Howells | 8c39b8b | 2022-01-14 11:44:54 +0000 | [diff] [blame] | 322 | ino_t ino, |
David Howells | 13871ba | 2021-11-16 16:30:25 +0000 | [diff] [blame] | 323 | enum fscache_why_object_killed why), |
| 324 | |
David Howells | 8c39b8b | 2022-01-14 11:44:54 +0000 | [diff] [blame] | 325 | TP_ARGS(obj, ino, why), |
David Howells | 13871ba | 2021-11-16 16:30:25 +0000 | [diff] [blame] | 326 | |
| 327 | /* Note that obj may be NULL */ |
| 328 | TP_STRUCT__entry( |
| 329 | __field(unsigned int, obj ) |
David Howells | 8c39b8b | 2022-01-14 11:44:54 +0000 | [diff] [blame] | 330 | __field(unsigned int, ino ) |
David Howells | 13871ba | 2021-11-16 16:30:25 +0000 | [diff] [blame] | 331 | __field(enum fscache_why_object_killed, why ) |
| 332 | ), |
| 333 | |
| 334 | TP_fast_assign( |
| 335 | __entry->obj = obj ? obj->debug_id : UINT_MAX; |
David Howells | 8c39b8b | 2022-01-14 11:44:54 +0000 | [diff] [blame] | 336 | __entry->ino = ino; |
David Howells | 13871ba | 2021-11-16 16:30:25 +0000 | [diff] [blame] | 337 | __entry->why = why; |
| 338 | ), |
| 339 | |
David Howells | 8c39b8b | 2022-01-14 11:44:54 +0000 | [diff] [blame] | 340 | TP_printk("o=%08x B=%x w=%s", |
| 341 | __entry->obj, __entry->ino, |
David Howells | 13871ba | 2021-11-16 16:30:25 +0000 | [diff] [blame] | 342 | __print_symbolic(__entry->why, cachefiles_obj_kill_traces)) |
| 343 | ); |
| 344 | |
| 345 | TRACE_EVENT(cachefiles_rename, |
| 346 | TP_PROTO(struct cachefiles_object *obj, |
David Howells | 8c39b8b | 2022-01-14 11:44:54 +0000 | [diff] [blame] | 347 | ino_t ino, |
David Howells | 13871ba | 2021-11-16 16:30:25 +0000 | [diff] [blame] | 348 | enum fscache_why_object_killed why), |
| 349 | |
David Howells | 8c39b8b | 2022-01-14 11:44:54 +0000 | [diff] [blame] | 350 | TP_ARGS(obj, ino, why), |
David Howells | 13871ba | 2021-11-16 16:30:25 +0000 | [diff] [blame] | 351 | |
| 352 | /* Note that obj may be NULL */ |
| 353 | TP_STRUCT__entry( |
| 354 | __field(unsigned int, obj ) |
David Howells | 8c39b8b | 2022-01-14 11:44:54 +0000 | [diff] [blame] | 355 | __field(unsigned int, ino ) |
David Howells | 13871ba | 2021-11-16 16:30:25 +0000 | [diff] [blame] | 356 | __field(enum fscache_why_object_killed, why ) |
| 357 | ), |
| 358 | |
| 359 | TP_fast_assign( |
| 360 | __entry->obj = obj ? obj->debug_id : UINT_MAX; |
David Howells | 8c39b8b | 2022-01-14 11:44:54 +0000 | [diff] [blame] | 361 | __entry->ino = ino; |
David Howells | 13871ba | 2021-11-16 16:30:25 +0000 | [diff] [blame] | 362 | __entry->why = why; |
| 363 | ), |
| 364 | |
David Howells | 8c39b8b | 2022-01-14 11:44:54 +0000 | [diff] [blame] | 365 | TP_printk("o=%08x B=%x w=%s", |
| 366 | __entry->obj, __entry->ino, |
David Howells | 13871ba | 2021-11-16 16:30:25 +0000 | [diff] [blame] | 367 | __print_symbolic(__entry->why, cachefiles_obj_kill_traces)) |
| 368 | ); |
| 369 | |
David Howells | 72b9578 | 2021-11-17 16:11:07 +0000 | [diff] [blame] | 370 | TRACE_EVENT(cachefiles_coherency, |
| 371 | TP_PROTO(struct cachefiles_object *obj, |
| 372 | ino_t ino, |
| 373 | enum cachefiles_content content, |
| 374 | enum cachefiles_coherency_trace why), |
| 375 | |
| 376 | TP_ARGS(obj, ino, content, why), |
| 377 | |
| 378 | /* Note that obj may be NULL */ |
| 379 | TP_STRUCT__entry( |
| 380 | __field(unsigned int, obj ) |
| 381 | __field(enum cachefiles_coherency_trace, why ) |
| 382 | __field(enum cachefiles_content, content ) |
| 383 | __field(u64, ino ) |
| 384 | ), |
| 385 | |
| 386 | TP_fast_assign( |
| 387 | __entry->obj = obj->debug_id; |
| 388 | __entry->why = why; |
| 389 | __entry->content = content; |
| 390 | __entry->ino = ino; |
| 391 | ), |
| 392 | |
David Howells | 8c39b8b | 2022-01-14 11:44:54 +0000 | [diff] [blame] | 393 | TP_printk("o=%08x %s B=%llx c=%u", |
David Howells | 72b9578 | 2021-11-17 16:11:07 +0000 | [diff] [blame] | 394 | __entry->obj, |
| 395 | __print_symbolic(__entry->why, cachefiles_coherency_traces), |
| 396 | __entry->ino, |
| 397 | __entry->content) |
| 398 | ); |
| 399 | |
David Howells | 32e1500 | 2021-12-14 09:51:43 +0000 | [diff] [blame] | 400 | TRACE_EVENT(cachefiles_vol_coherency, |
| 401 | TP_PROTO(struct cachefiles_volume *volume, |
| 402 | ino_t ino, |
| 403 | enum cachefiles_coherency_trace why), |
| 404 | |
| 405 | TP_ARGS(volume, ino, why), |
| 406 | |
| 407 | /* Note that obj may be NULL */ |
| 408 | TP_STRUCT__entry( |
| 409 | __field(unsigned int, vol ) |
| 410 | __field(enum cachefiles_coherency_trace, why ) |
| 411 | __field(u64, ino ) |
| 412 | ), |
| 413 | |
| 414 | TP_fast_assign( |
| 415 | __entry->vol = volume->vcookie->debug_id; |
| 416 | __entry->why = why; |
| 417 | __entry->ino = ino; |
| 418 | ), |
| 419 | |
David Howells | 8c39b8b | 2022-01-14 11:44:54 +0000 | [diff] [blame] | 420 | TP_printk("V=%08x %s B=%llx", |
David Howells | 32e1500 | 2021-12-14 09:51:43 +0000 | [diff] [blame] | 421 | __entry->vol, |
| 422 | __print_symbolic(__entry->why, cachefiles_coherency_traces), |
| 423 | __entry->ino) |
| 424 | ); |
| 425 | |
David Howells | 047487c | 2021-10-21 00:19:46 +0100 | [diff] [blame] | 426 | TRACE_EVENT(cachefiles_prep_read, |
| 427 | TP_PROTO(struct netfs_read_subrequest *sreq, |
| 428 | enum netfs_read_source source, |
| 429 | enum cachefiles_prepare_read_trace why, |
| 430 | ino_t cache_inode), |
| 431 | |
| 432 | TP_ARGS(sreq, source, why, cache_inode), |
| 433 | |
| 434 | TP_STRUCT__entry( |
| 435 | __field(unsigned int, rreq ) |
| 436 | __field(unsigned short, index ) |
| 437 | __field(unsigned short, flags ) |
| 438 | __field(enum netfs_read_source, source ) |
| 439 | __field(enum cachefiles_prepare_read_trace, why ) |
| 440 | __field(size_t, len ) |
| 441 | __field(loff_t, start ) |
| 442 | __field(unsigned int, netfs_inode ) |
| 443 | __field(unsigned int, cache_inode ) |
| 444 | ), |
| 445 | |
| 446 | TP_fast_assign( |
| 447 | __entry->rreq = sreq->rreq->debug_id; |
| 448 | __entry->index = sreq->debug_index; |
| 449 | __entry->flags = sreq->flags; |
| 450 | __entry->source = source; |
| 451 | __entry->why = why; |
| 452 | __entry->len = sreq->len; |
| 453 | __entry->start = sreq->start; |
| 454 | __entry->netfs_inode = sreq->rreq->inode->i_ino; |
| 455 | __entry->cache_inode = cache_inode; |
| 456 | ), |
| 457 | |
David Howells | 8c39b8b | 2022-01-14 11:44:54 +0000 | [diff] [blame] | 458 | TP_printk("R=%08x[%u] %s %s f=%02x s=%llx %zx ni=%x B=%x", |
David Howells | 047487c | 2021-10-21 00:19:46 +0100 | [diff] [blame] | 459 | __entry->rreq, __entry->index, |
| 460 | __print_symbolic(__entry->source, netfs_sreq_sources), |
| 461 | __print_symbolic(__entry->why, cachefiles_prepare_read_traces), |
| 462 | __entry->flags, |
| 463 | __entry->start, __entry->len, |
| 464 | __entry->netfs_inode, __entry->cache_inode) |
| 465 | ); |
| 466 | |
| 467 | TRACE_EVENT(cachefiles_read, |
| 468 | TP_PROTO(struct cachefiles_object *obj, |
| 469 | struct inode *backer, |
| 470 | loff_t start, |
| 471 | size_t len), |
| 472 | |
| 473 | TP_ARGS(obj, backer, start, len), |
| 474 | |
| 475 | TP_STRUCT__entry( |
| 476 | __field(unsigned int, obj ) |
| 477 | __field(unsigned int, backer ) |
| 478 | __field(size_t, len ) |
| 479 | __field(loff_t, start ) |
| 480 | ), |
| 481 | |
| 482 | TP_fast_assign( |
| 483 | __entry->obj = obj->debug_id; |
| 484 | __entry->backer = backer->i_ino; |
| 485 | __entry->start = start; |
| 486 | __entry->len = len; |
| 487 | ), |
| 488 | |
David Howells | 8c39b8b | 2022-01-14 11:44:54 +0000 | [diff] [blame] | 489 | TP_printk("o=%08x B=%x s=%llx l=%zx", |
David Howells | 047487c | 2021-10-21 00:19:46 +0100 | [diff] [blame] | 490 | __entry->obj, |
| 491 | __entry->backer, |
| 492 | __entry->start, |
| 493 | __entry->len) |
| 494 | ); |
| 495 | |
| 496 | TRACE_EVENT(cachefiles_write, |
| 497 | TP_PROTO(struct cachefiles_object *obj, |
| 498 | struct inode *backer, |
| 499 | loff_t start, |
| 500 | size_t len), |
| 501 | |
| 502 | TP_ARGS(obj, backer, start, len), |
| 503 | |
| 504 | TP_STRUCT__entry( |
| 505 | __field(unsigned int, obj ) |
| 506 | __field(unsigned int, backer ) |
| 507 | __field(size_t, len ) |
| 508 | __field(loff_t, start ) |
| 509 | ), |
| 510 | |
| 511 | TP_fast_assign( |
| 512 | __entry->obj = obj->debug_id; |
| 513 | __entry->backer = backer->i_ino; |
| 514 | __entry->start = start; |
| 515 | __entry->len = len; |
| 516 | ), |
| 517 | |
David Howells | 8c39b8b | 2022-01-14 11:44:54 +0000 | [diff] [blame] | 518 | TP_printk("o=%08x B=%x s=%llx l=%zx", |
David Howells | 047487c | 2021-10-21 00:19:46 +0100 | [diff] [blame] | 519 | __entry->obj, |
| 520 | __entry->backer, |
| 521 | __entry->start, |
| 522 | __entry->len) |
| 523 | ); |
| 524 | |
David Howells | 13871ba | 2021-11-16 16:30:25 +0000 | [diff] [blame] | 525 | TRACE_EVENT(cachefiles_trunc, |
| 526 | TP_PROTO(struct cachefiles_object *obj, struct inode *backer, |
| 527 | loff_t from, loff_t to, enum cachefiles_trunc_trace why), |
| 528 | |
| 529 | TP_ARGS(obj, backer, from, to, why), |
| 530 | |
| 531 | TP_STRUCT__entry( |
| 532 | __field(unsigned int, obj ) |
| 533 | __field(unsigned int, backer ) |
| 534 | __field(enum cachefiles_trunc_trace, why ) |
| 535 | __field(loff_t, from ) |
| 536 | __field(loff_t, to ) |
| 537 | ), |
| 538 | |
| 539 | TP_fast_assign( |
| 540 | __entry->obj = obj->debug_id; |
| 541 | __entry->backer = backer->i_ino; |
| 542 | __entry->from = from; |
| 543 | __entry->to = to; |
| 544 | __entry->why = why; |
| 545 | ), |
| 546 | |
David Howells | 8c39b8b | 2022-01-14 11:44:54 +0000 | [diff] [blame] | 547 | TP_printk("o=%08x B=%x %s l=%llx->%llx", |
David Howells | 13871ba | 2021-11-16 16:30:25 +0000 | [diff] [blame] | 548 | __entry->obj, |
| 549 | __entry->backer, |
| 550 | __print_symbolic(__entry->why, cachefiles_trunc_traces), |
| 551 | __entry->from, |
| 552 | __entry->to) |
| 553 | ); |
| 554 | |
David Howells | 1bd9c4e | 2021-11-18 08:58:08 +0000 | [diff] [blame] | 555 | TRACE_EVENT(cachefiles_mark_active, |
| 556 | TP_PROTO(struct cachefiles_object *obj, |
| 557 | struct inode *inode), |
| 558 | |
| 559 | TP_ARGS(obj, inode), |
| 560 | |
| 561 | /* Note that obj may be NULL */ |
| 562 | TP_STRUCT__entry( |
| 563 | __field(unsigned int, obj ) |
| 564 | __field(ino_t, inode ) |
| 565 | ), |
| 566 | |
| 567 | TP_fast_assign( |
| 568 | __entry->obj = obj ? obj->debug_id : 0; |
| 569 | __entry->inode = inode->i_ino; |
| 570 | ), |
| 571 | |
David Howells | 8c39b8b | 2022-01-14 11:44:54 +0000 | [diff] [blame] | 572 | TP_printk("o=%08x B=%lx", |
David Howells | 1bd9c4e | 2021-11-18 08:58:08 +0000 | [diff] [blame] | 573 | __entry->obj, __entry->inode) |
| 574 | ); |
| 575 | |
David Howells | b64a331 | 2022-01-14 11:05:13 +0000 | [diff] [blame] | 576 | TRACE_EVENT(cachefiles_mark_failed, |
| 577 | TP_PROTO(struct cachefiles_object *obj, |
| 578 | struct inode *inode), |
| 579 | |
| 580 | TP_ARGS(obj, inode), |
| 581 | |
| 582 | /* Note that obj may be NULL */ |
| 583 | TP_STRUCT__entry( |
| 584 | __field(unsigned int, obj ) |
| 585 | __field(ino_t, inode ) |
| 586 | ), |
| 587 | |
| 588 | TP_fast_assign( |
| 589 | __entry->obj = obj ? obj->debug_id : 0; |
| 590 | __entry->inode = inode->i_ino; |
| 591 | ), |
| 592 | |
| 593 | TP_printk("o=%08x B=%lx", |
| 594 | __entry->obj, __entry->inode) |
| 595 | ); |
| 596 | |
David Howells | 1bd9c4e | 2021-11-18 08:58:08 +0000 | [diff] [blame] | 597 | TRACE_EVENT(cachefiles_mark_inactive, |
| 598 | TP_PROTO(struct cachefiles_object *obj, |
| 599 | struct inode *inode), |
| 600 | |
| 601 | TP_ARGS(obj, inode), |
| 602 | |
| 603 | /* Note that obj may be NULL */ |
| 604 | TP_STRUCT__entry( |
| 605 | __field(unsigned int, obj ) |
| 606 | __field(ino_t, inode ) |
| 607 | ), |
| 608 | |
| 609 | TP_fast_assign( |
| 610 | __entry->obj = obj ? obj->debug_id : 0; |
| 611 | __entry->inode = inode->i_ino; |
| 612 | ), |
| 613 | |
David Howells | 8c39b8b | 2022-01-14 11:44:54 +0000 | [diff] [blame] | 614 | TP_printk("o=%08x B=%lx", |
David Howells | 1bd9c4e | 2021-11-18 08:58:08 +0000 | [diff] [blame] | 615 | __entry->obj, __entry->inode) |
| 616 | ); |
| 617 | |
David Howells | ecf5a6c | 2021-10-21 08:42:18 +0100 | [diff] [blame] | 618 | TRACE_EVENT(cachefiles_vfs_error, |
| 619 | TP_PROTO(struct cachefiles_object *obj, struct inode *backer, |
| 620 | int error, enum cachefiles_error_trace where), |
| 621 | |
| 622 | TP_ARGS(obj, backer, error, where), |
| 623 | |
| 624 | TP_STRUCT__entry( |
| 625 | __field(unsigned int, obj ) |
| 626 | __field(unsigned int, backer ) |
| 627 | __field(enum cachefiles_error_trace, where ) |
| 628 | __field(short, error ) |
| 629 | ), |
| 630 | |
| 631 | TP_fast_assign( |
| 632 | __entry->obj = obj ? obj->debug_id : 0; |
| 633 | __entry->backer = backer->i_ino; |
| 634 | __entry->error = error; |
| 635 | __entry->where = where; |
| 636 | ), |
| 637 | |
David Howells | 8c39b8b | 2022-01-14 11:44:54 +0000 | [diff] [blame] | 638 | TP_printk("o=%08x B=%x %s e=%d", |
David Howells | ecf5a6c | 2021-10-21 08:42:18 +0100 | [diff] [blame] | 639 | __entry->obj, |
| 640 | __entry->backer, |
| 641 | __print_symbolic(__entry->where, cachefiles_error_traces), |
| 642 | __entry->error) |
| 643 | ); |
| 644 | |
| 645 | TRACE_EVENT(cachefiles_io_error, |
| 646 | TP_PROTO(struct cachefiles_object *obj, struct inode *backer, |
| 647 | int error, enum cachefiles_error_trace where), |
| 648 | |
| 649 | TP_ARGS(obj, backer, error, where), |
| 650 | |
| 651 | TP_STRUCT__entry( |
| 652 | __field(unsigned int, obj ) |
| 653 | __field(unsigned int, backer ) |
| 654 | __field(enum cachefiles_error_trace, where ) |
| 655 | __field(short, error ) |
| 656 | ), |
| 657 | |
| 658 | TP_fast_assign( |
| 659 | __entry->obj = obj ? obj->debug_id : 0; |
| 660 | __entry->backer = backer->i_ino; |
| 661 | __entry->error = error; |
| 662 | __entry->where = where; |
| 663 | ), |
| 664 | |
David Howells | 8c39b8b | 2022-01-14 11:44:54 +0000 | [diff] [blame] | 665 | TP_printk("o=%08x B=%x %s e=%d", |
David Howells | ecf5a6c | 2021-10-21 08:42:18 +0100 | [diff] [blame] | 666 | __entry->obj, |
| 667 | __entry->backer, |
| 668 | __print_symbolic(__entry->where, cachefiles_error_traces), |
| 669 | __entry->error) |
| 670 | ); |
| 671 | |
David Howells | 77443f6 | 2021-11-26 14:32:29 +0000 | [diff] [blame] | 672 | #endif /* _TRACE_CACHEFILES_H */ |
| 673 | |
| 674 | /* This part must be outside protection */ |
| 675 | #include <trace/define_trace.h> |