diff options
Diffstat (limited to 'fs/fscache/operation.c')
-rw-r--r-- | fs/fscache/operation.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/fs/fscache/operation.c b/fs/fscache/operation.c index f1a2857b2ff5..91bbe6f0377c 100644 --- a/fs/fscache/operation.c +++ b/fs/fscache/operation.c | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #define FSCACHE_DEBUG_LEVEL OPERATION | 14 | #define FSCACHE_DEBUG_LEVEL OPERATION |
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/seq_file.h> | ||
16 | #include "internal.h" | 17 | #include "internal.h" |
17 | 18 | ||
18 | atomic_t fscache_op_debug_id; | 19 | atomic_t fscache_op_debug_id; |
@@ -31,6 +32,8 @@ void fscache_enqueue_operation(struct fscache_operation *op) | |||
31 | _enter("{OBJ%x OP%x,%u}", | 32 | _enter("{OBJ%x OP%x,%u}", |
32 | op->object->debug_id, op->debug_id, atomic_read(&op->usage)); | 33 | op->object->debug_id, op->debug_id, atomic_read(&op->usage)); |
33 | 34 | ||
35 | fscache_set_op_state(op, "EnQ"); | ||
36 | |||
34 | ASSERT(op->processor != NULL); | 37 | ASSERT(op->processor != NULL); |
35 | ASSERTCMP(op->object->state, >=, FSCACHE_OBJECT_AVAILABLE); | 38 | ASSERTCMP(op->object->state, >=, FSCACHE_OBJECT_AVAILABLE); |
36 | ASSERTCMP(atomic_read(&op->usage), >, 0); | 39 | ASSERTCMP(atomic_read(&op->usage), >, 0); |
@@ -67,6 +70,8 @@ EXPORT_SYMBOL(fscache_enqueue_operation); | |||
67 | static void fscache_run_op(struct fscache_object *object, | 70 | static void fscache_run_op(struct fscache_object *object, |
68 | struct fscache_operation *op) | 71 | struct fscache_operation *op) |
69 | { | 72 | { |
73 | fscache_set_op_state(op, "Run"); | ||
74 | |||
70 | object->n_in_progress++; | 75 | object->n_in_progress++; |
71 | if (test_and_clear_bit(FSCACHE_OP_WAITING, &op->flags)) | 76 | if (test_and_clear_bit(FSCACHE_OP_WAITING, &op->flags)) |
72 | wake_up_bit(&op->flags, FSCACHE_OP_WAITING); | 77 | wake_up_bit(&op->flags, FSCACHE_OP_WAITING); |
@@ -87,6 +92,8 @@ int fscache_submit_exclusive_op(struct fscache_object *object, | |||
87 | 92 | ||
88 | _enter("{OBJ%x OP%x},", object->debug_id, op->debug_id); | 93 | _enter("{OBJ%x OP%x},", object->debug_id, op->debug_id); |
89 | 94 | ||
95 | fscache_set_op_state(op, "SubmitX"); | ||
96 | |||
90 | spin_lock(&object->lock); | 97 | spin_lock(&object->lock); |
91 | ASSERTCMP(object->n_ops, >=, object->n_in_progress); | 98 | ASSERTCMP(object->n_ops, >=, object->n_in_progress); |
92 | ASSERTCMP(object->n_ops, >=, object->n_exclusive); | 99 | ASSERTCMP(object->n_ops, >=, object->n_exclusive); |
@@ -190,6 +197,8 @@ int fscache_submit_op(struct fscache_object *object, | |||
190 | 197 | ||
191 | ASSERTCMP(atomic_read(&op->usage), >, 0); | 198 | ASSERTCMP(atomic_read(&op->usage), >, 0); |
192 | 199 | ||
200 | fscache_set_op_state(op, "Submit"); | ||
201 | |||
193 | spin_lock(&object->lock); | 202 | spin_lock(&object->lock); |
194 | ASSERTCMP(object->n_ops, >=, object->n_in_progress); | 203 | ASSERTCMP(object->n_ops, >=, object->n_in_progress); |
195 | ASSERTCMP(object->n_ops, >=, object->n_exclusive); | 204 | ASSERTCMP(object->n_ops, >=, object->n_exclusive); |
@@ -298,6 +307,8 @@ void fscache_put_operation(struct fscache_operation *op) | |||
298 | if (!atomic_dec_and_test(&op->usage)) | 307 | if (!atomic_dec_and_test(&op->usage)) |
299 | return; | 308 | return; |
300 | 309 | ||
310 | fscache_set_op_state(op, "Put"); | ||
311 | |||
301 | _debug("PUT OP"); | 312 | _debug("PUT OP"); |
302 | if (test_and_set_bit(FSCACHE_OP_DEAD, &op->flags)) | 313 | if (test_and_set_bit(FSCACHE_OP_DEAD, &op->flags)) |
303 | BUG(); | 314 | BUG(); |
@@ -452,9 +463,27 @@ static void fscache_op_execute(struct slow_work *work) | |||
452 | _leave(""); | 463 | _leave(""); |
453 | } | 464 | } |
454 | 465 | ||
466 | /* | ||
467 | * describe an operation for slow-work debugging | ||
468 | */ | ||
469 | #ifdef CONFIG_SLOW_WORK_PROC | ||
470 | static void fscache_op_desc(struct slow_work *work, struct seq_file *m) | ||
471 | { | ||
472 | struct fscache_operation *op = | ||
473 | container_of(work, struct fscache_operation, slow_work); | ||
474 | |||
475 | seq_printf(m, "FSC: OBJ%x OP%x: %s/%s fl=%lx", | ||
476 | op->object->debug_id, op->debug_id, | ||
477 | op->name, op->state, op->flags); | ||
478 | } | ||
479 | #endif | ||
480 | |||
455 | const struct slow_work_ops fscache_op_slow_work_ops = { | 481 | const struct slow_work_ops fscache_op_slow_work_ops = { |
456 | .owner = THIS_MODULE, | 482 | .owner = THIS_MODULE, |
457 | .get_ref = fscache_op_get_ref, | 483 | .get_ref = fscache_op_get_ref, |
458 | .put_ref = fscache_op_put_ref, | 484 | .put_ref = fscache_op_put_ref, |
459 | .execute = fscache_op_execute, | 485 | .execute = fscache_op_execute, |
486 | #ifdef CONFIG_SLOW_WORK_PROC | ||
487 | .desc = fscache_op_desc, | ||
488 | #endif | ||
460 | }; | 489 | }; |