diff options
Diffstat (limited to 'fs/cachefiles/interface.c')
-rw-r--r-- | fs/cachefiles/interface.c | 18 |
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 | */ |
179 | static | 179 | static |
180 | struct fscache_object *cachefiles_grab_object(struct fscache_object *_object) | 180 | struct 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 | */ |
312 | static void cachefiles_put_object(struct fscache_object *_object) | 316 | static 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)); |