diff options
Diffstat (limited to 'fs/fscache/operation.c')
-rw-r--r-- | fs/fscache/operation.c | 67 |
1 files changed, 8 insertions, 59 deletions
diff --git a/fs/fscache/operation.c b/fs/fscache/operation.c index f17cecafae44..b9f34eaede09 100644 --- a/fs/fscache/operation.c +++ b/fs/fscache/operation.c | |||
@@ -42,16 +42,12 @@ void fscache_enqueue_operation(struct fscache_operation *op) | |||
42 | 42 | ||
43 | fscache_stat(&fscache_n_op_enqueue); | 43 | fscache_stat(&fscache_n_op_enqueue); |
44 | switch (op->flags & FSCACHE_OP_TYPE) { | 44 | switch (op->flags & FSCACHE_OP_TYPE) { |
45 | case FSCACHE_OP_FAST: | 45 | case FSCACHE_OP_ASYNC: |
46 | _debug("queue fast"); | 46 | _debug("queue async"); |
47 | atomic_inc(&op->usage); | 47 | atomic_inc(&op->usage); |
48 | if (!schedule_work(&op->fast_work)) | 48 | if (!queue_work(fscache_op_wq, &op->work)) |
49 | fscache_put_operation(op); | 49 | fscache_put_operation(op); |
50 | break; | 50 | break; |
51 | case FSCACHE_OP_SLOW: | ||
52 | _debug("queue slow"); | ||
53 | slow_work_enqueue(&op->slow_work); | ||
54 | break; | ||
55 | case FSCACHE_OP_MYTHREAD: | 51 | case FSCACHE_OP_MYTHREAD: |
56 | _debug("queue for caller's attention"); | 52 | _debug("queue for caller's attention"); |
57 | break; | 53 | break; |
@@ -455,36 +451,13 @@ void fscache_operation_gc(struct work_struct *work) | |||
455 | } | 451 | } |
456 | 452 | ||
457 | /* | 453 | /* |
458 | * allow the slow work item processor to get a ref on an operation | 454 | * execute an operation using fs_op_wq to provide processing context - |
459 | */ | 455 | * the caller holds a ref to this object, so we don't need to hold one |
460 | static int fscache_op_get_ref(struct slow_work *work) | ||
461 | { | ||
462 | struct fscache_operation *op = | ||
463 | container_of(work, struct fscache_operation, slow_work); | ||
464 | |||
465 | atomic_inc(&op->usage); | ||
466 | return 0; | ||
467 | } | ||
468 | |||
469 | /* | ||
470 | * allow the slow work item processor to discard a ref on an operation | ||
471 | */ | ||
472 | static void fscache_op_put_ref(struct slow_work *work) | ||
473 | { | ||
474 | struct fscache_operation *op = | ||
475 | container_of(work, struct fscache_operation, slow_work); | ||
476 | |||
477 | fscache_put_operation(op); | ||
478 | } | ||
479 | |||
480 | /* | ||
481 | * execute an operation using the slow thread pool to provide processing context | ||
482 | * - the caller holds a ref to this object, so we don't need to hold one | ||
483 | */ | 456 | */ |
484 | static void fscache_op_execute(struct slow_work *work) | 457 | void fscache_op_work_func(struct work_struct *work) |
485 | { | 458 | { |
486 | struct fscache_operation *op = | 459 | struct fscache_operation *op = |
487 | container_of(work, struct fscache_operation, slow_work); | 460 | container_of(work, struct fscache_operation, work); |
488 | unsigned long start; | 461 | unsigned long start; |
489 | 462 | ||
490 | _enter("{OBJ%x OP%x,%d}", | 463 | _enter("{OBJ%x OP%x,%d}", |
@@ -494,31 +467,7 @@ static void fscache_op_execute(struct slow_work *work) | |||
494 | start = jiffies; | 467 | start = jiffies; |
495 | op->processor(op); | 468 | op->processor(op); |
496 | fscache_hist(fscache_ops_histogram, start); | 469 | fscache_hist(fscache_ops_histogram, start); |
470 | fscache_put_operation(op); | ||
497 | 471 | ||
498 | _leave(""); | 472 | _leave(""); |
499 | } | 473 | } |
500 | |||
501 | /* | ||
502 | * describe an operation for slow-work debugging | ||
503 | */ | ||
504 | #ifdef CONFIG_SLOW_WORK_DEBUG | ||
505 | static void fscache_op_desc(struct slow_work *work, struct seq_file *m) | ||
506 | { | ||
507 | struct fscache_operation *op = | ||
508 | container_of(work, struct fscache_operation, slow_work); | ||
509 | |||
510 | seq_printf(m, "FSC: OBJ%x OP%x: %s/%s fl=%lx", | ||
511 | op->object->debug_id, op->debug_id, | ||
512 | op->name, op->state, op->flags); | ||
513 | } | ||
514 | #endif | ||
515 | |||
516 | const struct slow_work_ops fscache_op_slow_work_ops = { | ||
517 | .owner = THIS_MODULE, | ||
518 | .get_ref = fscache_op_get_ref, | ||
519 | .put_ref = fscache_op_put_ref, | ||
520 | .execute = fscache_op_execute, | ||
521 | #ifdef CONFIG_SLOW_WORK_DEBUG | ||
522 | .desc = fscache_op_desc, | ||
523 | #endif | ||
524 | }; | ||