Implement allocate, get, see and put functions for the cachefiles_object struct. The members of the struct we're going to need are also added. Additionally, implement a lifecycle tracepoint.
Showing the changes to include/trace (2 of 5 files). Show all
Unified · Split
| @@ -18,6 +18,21 @@ · 17 unmodified lines | |||
| 18 | #ifndef __CACHEFILES_DECLARE_TRACE_ENUMS_ONCE_ONLY | 18 | #ifndef __CACHEFILES_DECLARE_TRACE_ENUMS_ONCE_ONLY |
| 19 | #define __CACHEFILES_DECLARE_TRACE_ENUMS_ONCE_ONLY | 19 | #define __CACHEFILES_DECLARE_TRACE_ENUMS_ONCE_ONLY |
| 20 | 20 | ||
| 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 | |||
| 21 | enum fscache_why_object_killed { | 36 | enum fscache_why_object_killed { |
| 22 | FSCACHE_OBJECT_IS_STALE, | 37 | FSCACHE_OBJECT_IS_STALE, |
| 23 | FSCACHE_OBJECT_IS_WEIRD, | 38 | FSCACHE_OBJECT_IS_WEIRD, |
| @@ -66,6 +81,20 @@ enum cachefiles_error_trace { · 42 unmodified lines | |||
| 66 | EM(FSCACHE_OBJECT_WAS_RETIRED, "was_retired") \ | 81 | EM(FSCACHE_OBJECT_WAS_RETIRED, "was_retired") \ |
| 67 | E_(FSCACHE_OBJECT_WAS_CULLED, "was_culled") | 82 | E_(FSCACHE_OBJECT_WAS_CULLED, "was_culled") |
| 68 | 83 | ||
| 84 | #define cachefiles_obj_ref_traces \ | ||
| 85 | EM(cachefiles_obj_get_ioreq, "GET ioreq") \ | ||
| 86 | EM(cachefiles_obj_new, "NEW obj") \ | ||
| 87 | EM(cachefiles_obj_put_alloc_fail, "PUT alloc_fail") \ | ||
| 88 | EM(cachefiles_obj_put_detach, "PUT detach") \ | ||
| 89 | EM(cachefiles_obj_put_ioreq, "PUT ioreq") \ | ||
| 90 | EM(cachefiles_obj_see_clean_commit, "SEE clean_commit") \ | ||
| 91 | EM(cachefiles_obj_see_clean_delete, "SEE clean_delete") \ | ||
| 92 | EM(cachefiles_obj_see_clean_drop_tmp, "SEE clean_drop_tmp") \ | ||
| 93 | EM(cachefiles_obj_see_lookup_cookie, "SEE lookup_cookie") \ | ||
| 94 | EM(cachefiles_obj_see_lookup_failed, "SEE lookup_failed") \ | ||
| 95 | EM(cachefiles_obj_see_withdraw_cookie, "SEE withdraw_cookie") \ | ||
| 96 | E_(cachefiles_obj_see_withdrawal, "SEE withdrawal") | ||
| 97 | |||
| 69 | #define cachefiles_trunc_traces \ | 98 | #define cachefiles_trunc_traces \ |
| 70 | EM(cachefiles_trunc_dio_adjust, "DIOADJ") \ | 99 | EM(cachefiles_trunc_dio_adjust, "DIOADJ") \ |
| 71 | EM(cachefiles_trunc_expand_tmpfile, "EXPTMP") \ | 100 | EM(cachefiles_trunc_expand_tmpfile, "EXPTMP") \ |
| @@ -100,6 +129,7 @@ enum cachefiles_error_trace { · 28 unmodified lines | |||
| 100 | #define E_(a, b) TRACE_DEFINE_ENUM(a); | 129 | #define E_(a, b) TRACE_DEFINE_ENUM(a); |
| 101 | 130 | ||
| 102 | cachefiles_obj_kill_traces; | 131 | cachefiles_obj_kill_traces; |
| 132 | cachefiles_obj_ref_traces; | ||
| 103 | cachefiles_trunc_traces; | 133 | cachefiles_trunc_traces; |
| 104 | cachefiles_error_traces; | 134 | cachefiles_error_traces; |
| 105 | 135 | ||
| @@ -113,6 +143,34 @@ cachefiles_error_traces; · 7 unmodified lines | |||
| 113 | #define E_(a, b) { a, b } | 143 | #define E_(a, b) { a, b } |
| 114 | 144 | ||
| 115 | 145 | ||
| 146 | TRACE_EVENT(cachefiles_ref, | ||
| 147 | TP_PROTO(unsigned int object_debug_id, | ||
| 148 | unsigned int cookie_debug_id, | ||
| 149 | int usage, | ||
| 150 | enum cachefiles_obj_ref_trace why), | ||
| 151 | |||
| 152 | TP_ARGS(object_debug_id, cookie_debug_id, usage, why), | ||
| 153 | |||
| 154 | /* Note that obj may be NULL */ | ||
| 155 | TP_STRUCT__entry( | ||
| 156 | __field(unsigned int, obj ) | ||
| 157 | __field(unsigned int, cookie ) | ||
| 158 | __field(enum cachefiles_obj_ref_trace, why ) | ||
| 159 | __field(int, usage ) | ||
| 160 | ), | ||
| 161 | |||
| 162 | TP_fast_assign( | ||
| 163 | __entry->obj = object_debug_id; | ||
| 164 | __entry->cookie = cookie_debug_id; | ||
| 165 | __entry->usage = usage; | ||
| 166 | __entry->why = why; | ||
| 167 | ), | ||
| 168 | |||
| 169 | TP_printk("c=%08x o=%08x u=%d %s", | ||
| 170 | __entry->cookie, __entry->obj, __entry->usage, | ||
| 171 | __print_symbolic(__entry->why, cachefiles_obj_ref_traces)) | ||
| 172 | ); | ||
| 173 | |||
| 116 | TRACE_EVENT(cachefiles_lookup, | 174 | TRACE_EVENT(cachefiles_lookup, |
| 117 | TP_PROTO(struct cachefiles_object *obj, | 175 | TP_PROTO(struct cachefiles_object *obj, |
| 118 | struct dentry *de), | 176 | struct dentry *de), |
| @@ -49,6 +49,7 @@ enum fscache_volume_trace { · 48 unmodified lines | |||
| 49 | enum fscache_cookie_trace { | 49 | enum fscache_cookie_trace { |
| 50 | fscache_cookie_collision, | 50 | fscache_cookie_collision, |
| 51 | fscache_cookie_discard, | 51 | fscache_cookie_discard, |
| 52 | fscache_cookie_get_attach_object, | ||
| 52 | fscache_cookie_get_end_access, | 53 | fscache_cookie_get_end_access, |
| 53 | fscache_cookie_get_hash_collision, | 54 | fscache_cookie_get_hash_collision, |
| 54 | fscache_cookie_get_inval_work, | 55 | fscache_cookie_get_inval_work, |
| @@ -57,6 +58,7 @@ enum fscache_cookie_trace { · 2 unmodified lines | |||
| 57 | fscache_cookie_new_acquire, | 58 | fscache_cookie_new_acquire, |
| 58 | fscache_cookie_put_hash_collision, | 59 | fscache_cookie_put_hash_collision, |
| 59 | fscache_cookie_put_lru, | 60 | fscache_cookie_put_lru, |
| 61 | fscache_cookie_put_object, | ||
| 60 | fscache_cookie_put_over_queued, | 62 | fscache_cookie_put_over_queued, |
| 61 | fscache_cookie_put_relinquish, | 63 | fscache_cookie_put_relinquish, |
| 62 | fscache_cookie_put_withdrawn, | 64 | fscache_cookie_put_withdrawn, |
| @@ -122,6 +124,7 @@ enum fscache_access_trace { · 59 unmodified lines | |||
| 122 | #define fscache_cookie_traces \ | 124 | #define fscache_cookie_traces \ |
| 123 | EM(fscache_cookie_collision, "*COLLIDE*") \ | 125 | EM(fscache_cookie_collision, "*COLLIDE*") \ |
| 124 | EM(fscache_cookie_discard, "DISCARD ") \ | 126 | EM(fscache_cookie_discard, "DISCARD ") \ |
| 127 | EM(fscache_cookie_get_attach_object, "GET attch") \ | ||
| 125 | EM(fscache_cookie_get_hash_collision, "GET hcoll") \ | 128 | EM(fscache_cookie_get_hash_collision, "GET hcoll") \ |
| 126 | EM(fscache_cookie_get_end_access, "GQ endac") \ | 129 | EM(fscache_cookie_get_end_access, "GQ endac") \ |
| 127 | EM(fscache_cookie_get_inval_work, "GQ inval") \ | 130 | EM(fscache_cookie_get_inval_work, "GQ inval") \ |
| @@ -130,6 +133,7 @@ enum fscache_access_trace { · 2 unmodified lines | |||
| 130 | EM(fscache_cookie_new_acquire, "NEW acq ") \ | 133 | EM(fscache_cookie_new_acquire, "NEW acq ") \ |
| 131 | EM(fscache_cookie_put_hash_collision, "PUT hcoll") \ | 134 | EM(fscache_cookie_put_hash_collision, "PUT hcoll") \ |
| 132 | EM(fscache_cookie_put_lru, "PUT lru ") \ | 135 | EM(fscache_cookie_put_lru, "PUT lru ") \ |
| 136 | EM(fscache_cookie_put_object, "PUT obj ") \ | ||
| 133 | EM(fscache_cookie_put_over_queued, "PQ overq") \ | 137 | EM(fscache_cookie_put_over_queued, "PQ overq") \ |
| 134 | EM(fscache_cookie_put_relinquish, "PUT relnq") \ | 138 | EM(fscache_cookie_put_relinquish, "PUT relnq") \ |
| 135 | EM(fscache_cookie_put_withdrawn, "PUT wthdn") \ | 139 | EM(fscache_cookie_put_withdrawn, "PUT wthdn") \ |