Skip to content

Commit 08c2e3d

Browse files
committed
fscache: Add more tracepoints
Add more tracepoints to fscache, including: (*) fscache_page - Tracks netfs pages known to fscache. (*) fscache_check_page - Tracks the netfs querying whether a page is pending storage. (*) fscache_wake_cookie - Tracks cookies being woken up after a page completes/aborts storage in the cache. (*) fscache_op - Tracks operations being initialised. (*) fscache_wrote_page - Tracks return of the backend write_page op. (*) fscache_gang_lookup - Tracks lookup of pages to be stored in the write operation. Signed-off-by: David Howells <dhowells@redhat.com>
1 parent a18feb5 commit 08c2e3d

File tree

6 files changed

+330
-8
lines changed

6 files changed

+330
-8
lines changed

fs/fscache/cookie.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,10 +691,11 @@ int __fscache_check_consistency(struct fscache_cookie *cookie)
691691
if (!op)
692692
return -ENOMEM;
693693

694-
fscache_operation_init(op, NULL, NULL, NULL);
694+
fscache_operation_init(cookie, op, NULL, NULL, NULL);
695695
op->flags = FSCACHE_OP_MYTHREAD |
696696
(1 << FSCACHE_OP_WAITING) |
697697
(1 << FSCACHE_OP_UNUSE_COOKIE);
698+
trace_fscache_page_op(cookie, NULL, op, fscache_page_op_check_consistency);
698699

699700
spin_lock(&cookie->lock);
700701

fs/fscache/object.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,11 +982,12 @@ static const struct fscache_state *_fscache_invalidate_object(struct fscache_obj
982982
if (!op)
983983
goto nomem;
984984

985-
fscache_operation_init(op, object->cache->ops->invalidate_object,
985+
fscache_operation_init(cookie, op, object->cache->ops->invalidate_object,
986986
NULL, NULL);
987987
op->flags = FSCACHE_OP_ASYNC |
988988
(1 << FSCACHE_OP_EXCLUSIVE) |
989989
(1 << FSCACHE_OP_UNUSE_COOKIE);
990+
trace_fscache_page_op(cookie, NULL, op, fscache_page_op_invalidate);
990991

991992
spin_lock(&cookie->lock);
992993
if (fscache_submit_exclusive_op(object, op) < 0)

fs/fscache/operation.c

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ static void fscache_operation_dummy_cancel(struct fscache_operation *op)
3232
* Do basic initialisation of an operation. The caller must still set flags,
3333
* object and processor if needed.
3434
*/
35-
void fscache_operation_init(struct fscache_operation *op,
35+
void fscache_operation_init(struct fscache_cookie *cookie,
36+
struct fscache_operation *op,
3637
fscache_operation_processor_t processor,
3738
fscache_operation_cancel_t cancel,
3839
fscache_operation_release_t release)
@@ -46,6 +47,7 @@ void fscache_operation_init(struct fscache_operation *op,
4647
op->release = release;
4748
INIT_LIST_HEAD(&op->pend_link);
4849
fscache_stat(&fscache_n_op_initialised);
50+
trace_fscache_op(cookie, op, fscache_op_init);
4951
}
5052
EXPORT_SYMBOL(fscache_operation_init);
5153

@@ -59,6 +61,8 @@ EXPORT_SYMBOL(fscache_operation_init);
5961
*/
6062
void fscache_enqueue_operation(struct fscache_operation *op)
6163
{
64+
struct fscache_cookie *cookie = op->object->cookie;
65+
6266
_enter("{OBJ%x OP%x,%u}",
6367
op->object->debug_id, op->debug_id, atomic_read(&op->usage));
6468

@@ -71,12 +75,14 @@ void fscache_enqueue_operation(struct fscache_operation *op)
7175
fscache_stat(&fscache_n_op_enqueue);
7276
switch (op->flags & FSCACHE_OP_TYPE) {
7377
case FSCACHE_OP_ASYNC:
78+
trace_fscache_op(cookie, op, fscache_op_enqueue_async);
7479
_debug("queue async");
7580
atomic_inc(&op->usage);
7681
if (!queue_work(fscache_op_wq, &op->work))
7782
fscache_put_operation(op);
7883
break;
7984
case FSCACHE_OP_MYTHREAD:
85+
trace_fscache_op(cookie, op, fscache_op_enqueue_mythread);
8086
_debug("queue for caller's attention");
8187
break;
8288
default:
@@ -101,6 +107,8 @@ static void fscache_run_op(struct fscache_object *object,
101107
wake_up_bit(&op->flags, FSCACHE_OP_WAITING);
102108
if (op->processor)
103109
fscache_enqueue_operation(op);
110+
else
111+
trace_fscache_op(object->cookie, op, fscache_op_run);
104112
fscache_stat(&fscache_n_op_run);
105113
}
106114

@@ -155,6 +163,8 @@ int fscache_submit_exclusive_op(struct fscache_object *object,
155163

156164
_enter("{OBJ%x OP%x},", object->debug_id, op->debug_id);
157165

166+
trace_fscache_op(object->cookie, op, fscache_op_submit_ex);
167+
158168
ASSERTCMP(op->state, ==, FSCACHE_OP_ST_INITIALISED);
159169
ASSERTCMP(atomic_read(&op->usage), >, 0);
160170

@@ -240,6 +250,8 @@ int fscache_submit_op(struct fscache_object *object,
240250
_enter("{OBJ%x OP%x},{%u}",
241251
object->debug_id, op->debug_id, atomic_read(&op->usage));
242252

253+
trace_fscache_op(object->cookie, op, fscache_op_submit);
254+
243255
ASSERTCMP(op->state, ==, FSCACHE_OP_ST_INITIALISED);
244256
ASSERTCMP(atomic_read(&op->usage), >, 0);
245257

@@ -357,6 +369,8 @@ int fscache_cancel_op(struct fscache_operation *op,
357369

358370
_enter("OBJ%x OP%x}", op->object->debug_id, op->debug_id);
359371

372+
trace_fscache_op(object->cookie, op, fscache_op_cancel);
373+
360374
ASSERTCMP(op->state, >=, FSCACHE_OP_ST_PENDING);
361375
ASSERTCMP(op->state, !=, FSCACHE_OP_ST_CANCELLED);
362376
ASSERTCMP(atomic_read(&op->usage), >, 0);
@@ -419,6 +433,8 @@ void fscache_cancel_all_ops(struct fscache_object *object)
419433
fscache_stat(&fscache_n_op_cancelled);
420434
list_del_init(&op->pend_link);
421435

436+
trace_fscache_op(object->cookie, op, fscache_op_cancel_all);
437+
422438
ASSERTCMP(op->state, ==, FSCACHE_OP_ST_PENDING);
423439
op->cancel(op);
424440
op->state = FSCACHE_OP_ST_CANCELLED;
@@ -454,9 +470,11 @@ void fscache_op_complete(struct fscache_operation *op, bool cancelled)
454470
spin_lock(&object->lock);
455471

456472
if (!cancelled) {
473+
trace_fscache_op(object->cookie, op, fscache_op_completed);
457474
op->state = FSCACHE_OP_ST_COMPLETE;
458475
} else {
459476
op->cancel(op);
477+
trace_fscache_op(object->cookie, op, fscache_op_cancelled);
460478
op->state = FSCACHE_OP_ST_CANCELLED;
461479
}
462480

@@ -488,6 +506,8 @@ void fscache_put_operation(struct fscache_operation *op)
488506
if (!atomic_dec_and_test(&op->usage))
489507
return;
490508

509+
trace_fscache_op(op->object->cookie, op, fscache_op_put);
510+
491511
_debug("PUT OP");
492512
ASSERTIFCMP(op->state != FSCACHE_OP_ST_INITIALISED &&
493513
op->state != FSCACHE_OP_ST_COMPLETE,
@@ -563,6 +583,8 @@ void fscache_operation_gc(struct work_struct *work)
563583
spin_unlock(&cache->op_gc_list_lock);
564584

565585
object = op->object;
586+
trace_fscache_op(object->cookie, op, fscache_op_gc);
587+
566588
spin_lock(&object->lock);
567589

568590
_debug("GC DEFERRED REL OBJ%x OP%x",
@@ -601,6 +623,8 @@ void fscache_op_work_func(struct work_struct *work)
601623
_enter("{OBJ%x OP%x,%d}",
602624
op->object->debug_id, op->debug_id, atomic_read(&op->usage));
603625

626+
trace_fscache_op(op->object->cookie, op, fscache_op_work);
627+
604628
ASSERT(op->processor != NULL);
605629
start = jiffies;
606630
op->processor(op);

0 commit comments

Comments
 (0)