aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cachefiles/interface.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2018-04-04 08:41:27 -0400
committerDavid Howells <dhowells@redhat.com>2018-04-04 08:41:27 -0400
commita18feb55769b705a44c4107786c4045eae2e87b6 (patch)
tree3db7d160e672aa9f16a0437b767b3d3bbb10ecc8 /fs/cachefiles/interface.c
parent2c98425720233ae3e135add0c7e869b32913502f (diff)
fscache: Add tracepoints
Add some tracepoints to fscache: (*) fscache_cookie - Tracks a cookie's usage count. (*) fscache_netfs - Logs registration of a network filesystem, including the pointer to the cookie allocated. (*) fscache_acquire - Logs cookie acquisition. (*) fscache_relinquish - Logs cookie relinquishment. (*) fscache_enable - Logs enablement of a cookie. (*) fscache_disable - Logs disablement of a cookie. (*) fscache_osm - Tracks execution of states in the object state machine. and cachefiles: (*) cachefiles_ref - Tracks a cachefiles object's usage count. (*) cachefiles_lookup - Logs result of lookup_one_len(). (*) cachefiles_mkdir - Logs result of vfs_mkdir(). (*) cachefiles_create - Logs result of vfs_create(). (*) cachefiles_unlink - Logs calls to vfs_unlink(). (*) cachefiles_rename - Logs calls to vfs_rename(). (*) cachefiles_mark_active - Logs an object becoming active. (*) cachefiles_wait_active - Logs a wait for an old object to be destroyed. (*) cachefiles_mark_inactive - Logs an object becoming inactive. (*) cachefiles_mark_buried - Logs the burial of an object. Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'fs/cachefiles/interface.c')
-rw-r--r--fs/cachefiles/interface.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/fs/cachefiles/interface.c b/fs/cachefiles/interface.c
index e7f16a77a22a..405ebc3932c2 100644
--- a/fs/cachefiles/interface.c
+++ b/fs/cachefiles/interface.c
@@ -177,10 +177,12 @@ static void cachefiles_lookup_complete(struct fscache_object *_object)
177 * increment the usage count on an inode object (may fail if unmounting) 177 * increment the usage count on an inode object (may fail if unmounting)
178 */ 178 */
179static 179static
180struct fscache_object *cachefiles_grab_object(struct fscache_object *_object) 180struct fscache_object *cachefiles_grab_object(struct fscache_object *_object,
181 enum fscache_obj_ref_trace why)
181{ 182{
182 struct cachefiles_object *object = 183 struct cachefiles_object *object =
183 container_of(_object, struct cachefiles_object, fscache); 184 container_of(_object, struct cachefiles_object, fscache);
185 int u;
184 186
185 _enter("{OBJ%x,%d}", _object->debug_id, atomic_read(&object->usage)); 187 _enter("{OBJ%x,%d}", _object->debug_id, atomic_read(&object->usage));
186 188
@@ -188,7 +190,9 @@ struct fscache_object *cachefiles_grab_object(struct fscache_object *_object)
188 ASSERT((atomic_read(&object->usage) & 0xffff0000) != 0x6b6b0000); 190 ASSERT((atomic_read(&object->usage) & 0xffff0000) != 0x6b6b0000);
189#endif 191#endif
190 192
191 atomic_inc(&object->usage); 193 u = atomic_inc_return(&object->usage);
194 trace_cachefiles_ref(object, _object->cookie,
195 (enum cachefiles_obj_ref_trace)why, u);
192 return &object->fscache; 196 return &object->fscache;
193} 197}
194 198
@@ -309,10 +313,12 @@ static void cachefiles_drop_object(struct fscache_object *_object)
309/* 313/*
310 * dispose of a reference to an object 314 * dispose of a reference to an object
311 */ 315 */
312static void cachefiles_put_object(struct fscache_object *_object) 316static void cachefiles_put_object(struct fscache_object *_object,
317 enum fscache_obj_ref_trace why)
313{ 318{
314 struct cachefiles_object *object; 319 struct cachefiles_object *object;
315 struct fscache_cache *cache; 320 struct fscache_cache *cache;
321 int u;
316 322
317 ASSERT(_object); 323 ASSERT(_object);
318 324
@@ -328,7 +334,11 @@ static void cachefiles_put_object(struct fscache_object *_object)
328 ASSERTIFCMP(object->fscache.parent, 334 ASSERTIFCMP(object->fscache.parent,
329 object->fscache.parent->n_children, >, 0); 335 object->fscache.parent->n_children, >, 0);
330 336
331 if (atomic_dec_and_test(&object->usage)) { 337 u = atomic_dec_return(&object->usage);
338 trace_cachefiles_ref(object, _object->cookie,
339 (enum cachefiles_obj_ref_trace)why, u);
340 ASSERTCMP(u, !=, -1);
341 if (u == 0) {
332 _debug("- kill object OBJ%x", object->fscache.debug_id); 342 _debug("- kill object OBJ%x", object->fscache.debug_id);
333 343
334 ASSERT(!test_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags)); 344 ASSERT(!test_bit(CACHEFILES_OBJECT_ACTIVE, &object->flags));