@@ -120,6 +120,7 @@ static void cachefiles_mark_object_buried(struct cachefiles_cache *cache,
120
120
}
121
121
122
122
write_unlock (& cache -> active_lock );
123
+ trace_cachefiles_mark_buried (NULL , dentry , why );
123
124
_leave (" [no owner]" );
124
125
return ;
125
126
@@ -130,6 +131,8 @@ static void cachefiles_mark_object_buried(struct cachefiles_cache *cache,
130
131
object -> fscache .state -> name ,
131
132
dentry );
132
133
134
+ trace_cachefiles_mark_buried (object , dentry , why );
135
+
133
136
if (fscache_object_is_live (& object -> fscache )) {
134
137
pr_err ("\n" );
135
138
pr_err ("Error: Can't preemptively bury live object\n" );
@@ -158,13 +161,15 @@ static int cachefiles_mark_object_active(struct cachefiles_cache *cache,
158
161
try_again :
159
162
write_lock (& cache -> active_lock );
160
163
164
+ dentry = object -> dentry ;
165
+ trace_cachefiles_mark_active (object , dentry );
166
+
161
167
if (test_and_set_bit (CACHEFILES_OBJECT_ACTIVE , & object -> flags )) {
162
168
pr_err ("Error: Object already active\n" );
163
169
cachefiles_printk_object (object , NULL );
164
170
BUG ();
165
171
}
166
172
167
- dentry = object -> dentry ;
168
173
_p = & cache -> active_nodes .rb_node ;
169
174
while (* _p ) {
170
175
_parent = * _p ;
@@ -191,6 +196,8 @@ static int cachefiles_mark_object_active(struct cachefiles_cache *cache,
191
196
/* an old object from a previous incarnation is hogging the slot - we
192
197
* need to wait for it to be destroyed */
193
198
wait_for_old_object :
199
+ trace_cachefiles_wait_active (object , dentry , xobject );
200
+
194
201
if (fscache_object_is_live (& xobject -> fscache )) {
195
202
pr_err ("\n" );
196
203
pr_err ("Error: Unexpected object collision\n" );
@@ -248,12 +255,12 @@ static int cachefiles_mark_object_active(struct cachefiles_cache *cache,
248
255
249
256
ASSERT (!test_bit (CACHEFILES_OBJECT_ACTIVE , & xobject -> flags ));
250
257
251
- cache -> cache .ops -> put_object (& xobject -> fscache );
258
+ cache -> cache .ops -> put_object (& xobject -> fscache , cachefiles_obj_put_wait_retry );
252
259
goto try_again ;
253
260
254
261
requeue :
255
262
clear_bit (CACHEFILES_OBJECT_ACTIVE , & object -> flags );
256
- cache -> cache .ops -> put_object (& xobject -> fscache );
263
+ cache -> cache .ops -> put_object (& xobject -> fscache , cachefiles_obj_put_wait_timeo );
257
264
_leave (" = -ETIMEDOUT" );
258
265
return - ETIMEDOUT ;
259
266
}
@@ -265,6 +272,11 @@ void cachefiles_mark_object_inactive(struct cachefiles_cache *cache,
265
272
struct cachefiles_object * object ,
266
273
blkcnt_t i_blocks )
267
274
{
275
+ struct dentry * dentry = object -> dentry ;
276
+ struct inode * inode = d_backing_inode (dentry );
277
+
278
+ trace_cachefiles_mark_inactive (object , dentry , inode );
279
+
268
280
write_lock (& cache -> active_lock );
269
281
rb_erase (& object -> active_node , & cache -> active_nodes );
270
282
clear_bit (CACHEFILES_OBJECT_ACTIVE , & object -> flags );
@@ -288,6 +300,7 @@ void cachefiles_mark_object_inactive(struct cachefiles_cache *cache,
288
300
* - unlocks the directory mutex
289
301
*/
290
302
static int cachefiles_bury_object (struct cachefiles_cache * cache ,
303
+ struct cachefiles_object * object ,
291
304
struct dentry * dir ,
292
305
struct dentry * rep ,
293
306
bool preemptive ,
@@ -312,6 +325,7 @@ static int cachefiles_bury_object(struct cachefiles_cache *cache,
312
325
if (ret < 0 ) {
313
326
cachefiles_io_error (cache , "Unlink security error" );
314
327
} else {
328
+ trace_cachefiles_unlink (object , rep , why );
315
329
ret = vfs_unlink (d_inode (dir ), rep , NULL );
316
330
317
331
if (preemptive )
@@ -413,6 +427,7 @@ static int cachefiles_bury_object(struct cachefiles_cache *cache,
413
427
if (ret < 0 ) {
414
428
cachefiles_io_error (cache , "Rename security error %d" , ret );
415
429
} else {
430
+ trace_cachefiles_rename (object , rep , grave , why );
416
431
ret = vfs_rename (d_inode (dir ), rep ,
417
432
d_inode (cache -> graveyard ), grave , NULL , 0 );
418
433
if (ret != 0 && ret != - ENOMEM )
@@ -458,7 +473,7 @@ int cachefiles_delete_object(struct cachefiles_cache *cache,
458
473
/* we need to check that our parent is _still_ our parent - it
459
474
* may have been renamed */
460
475
if (dir == object -> dentry -> d_parent ) {
461
- ret = cachefiles_bury_object (cache , dir ,
476
+ ret = cachefiles_bury_object (cache , object , dir ,
462
477
object -> dentry , false,
463
478
FSCACHE_OBJECT_WAS_RETIRED );
464
479
} else {
@@ -486,6 +501,7 @@ int cachefiles_walk_to_object(struct cachefiles_object *parent,
486
501
{
487
502
struct cachefiles_cache * cache ;
488
503
struct dentry * dir , * next = NULL ;
504
+ struct inode * inode ;
489
505
struct path path ;
490
506
unsigned long start ;
491
507
const char * name ;
@@ -529,13 +545,17 @@ int cachefiles_walk_to_object(struct cachefiles_object *parent,
529
545
start = jiffies ;
530
546
next = lookup_one_len (name , dir , nlen );
531
547
cachefiles_hist (cachefiles_lookup_histogram , start );
532
- if (IS_ERR (next ))
548
+ if (IS_ERR (next )) {
549
+ trace_cachefiles_lookup (object , next , NULL );
533
550
goto lookup_error ;
551
+ }
534
552
535
- _debug ("next -> %p %s" , next , d_backing_inode (next ) ? "positive" : "negative" );
553
+ inode = d_backing_inode (next );
554
+ trace_cachefiles_lookup (object , next , inode );
555
+ _debug ("next -> %p %s" , next , inode ? "positive" : "negative" );
536
556
537
557
if (!key )
538
- object -> new = !d_backing_inode ( next ) ;
558
+ object -> new = !inode ;
539
559
540
560
/* if this element of the path doesn't exist, then the lookup phase
541
561
* failed, and we can release any readers in the certain knowledge that
@@ -558,6 +578,8 @@ int cachefiles_walk_to_object(struct cachefiles_object *parent,
558
578
start = jiffies ;
559
579
ret = vfs_mkdir (d_inode (dir ), next , 0 );
560
580
cachefiles_hist (cachefiles_mkdir_histogram , start );
581
+ if (!key )
582
+ trace_cachefiles_mkdir (object , next , ret );
561
583
if (ret < 0 )
562
584
goto create_error ;
563
585
@@ -587,6 +609,7 @@ int cachefiles_walk_to_object(struct cachefiles_object *parent,
587
609
start = jiffies ;
588
610
ret = vfs_create (d_inode (dir ), next , S_IFREG , true);
589
611
cachefiles_hist (cachefiles_create_histogram , start );
612
+ trace_cachefiles_create (object , next , ret );
590
613
if (ret < 0 )
591
614
goto create_error ;
592
615
@@ -629,7 +652,8 @@ int cachefiles_walk_to_object(struct cachefiles_object *parent,
629
652
* mutex) */
630
653
object -> dentry = NULL ;
631
654
632
- ret = cachefiles_bury_object (cache , dir , next , true,
655
+ ret = cachefiles_bury_object (cache , object , dir , next ,
656
+ true,
633
657
FSCACHE_OBJECT_IS_STALE );
634
658
dput (next );
635
659
next = NULL ;
@@ -955,7 +979,7 @@ int cachefiles_cull(struct cachefiles_cache *cache, struct dentry *dir,
955
979
/* actually remove the victim (drops the dir mutex) */
956
980
_debug ("bury" );
957
981
958
- ret = cachefiles_bury_object (cache , dir , victim , false,
982
+ ret = cachefiles_bury_object (cache , NULL , dir , victim , false,
959
983
FSCACHE_OBJECT_WAS_CULLED );
960
984
if (ret < 0 )
961
985
goto error ;
0 commit comments