blob: dec6defe3be30941bbd0171bfba560e42bd78919 [file] [log] [blame]
David Howells952efe72009-04-03 16:42:39 +01001/* FS-Cache worker operation management routines
2 *
3 * Copyright (C) 2008 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 * See Documentation/filesystems/caching/operations.txt
12 */
13
14#define FSCACHE_DEBUG_LEVEL OPERATION
15#include <linux/module.h>
David Howells440f0af2009-11-19 18:11:01 +000016#include <linux/seq_file.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090017#include <linux/slab.h>
David Howells952efe72009-04-03 16:42:39 +010018#include "internal.h"
19
20atomic_t fscache_op_debug_id;
21EXPORT_SYMBOL(fscache_op_debug_id);
22
23/**
24 * fscache_enqueue_operation - Enqueue an operation for processing
25 * @op: The operation to enqueue
26 *
27 * Enqueue an operation for processing by the FS-Cache thread pool.
28 *
29 * This will get its own ref on the object.
30 */
31void fscache_enqueue_operation(struct fscache_operation *op)
32{
33 _enter("{OBJ%x OP%x,%u}",
34 op->object->debug_id, op->debug_id, atomic_read(&op->usage));
35
David Howells5753c442009-11-19 18:11:19 +000036 ASSERT(list_empty(&op->pend_link));
David Howells952efe72009-04-03 16:42:39 +010037 ASSERT(op->processor != NULL);
David Howells493f7bc2013-05-10 19:50:26 +010038 ASSERT(fscache_object_is_available(op->object));
David Howells952efe72009-04-03 16:42:39 +010039 ASSERTCMP(atomic_read(&op->usage), >, 0);
David Howells9f105232012-12-20 21:52:35 +000040 ASSERTCMP(op->state, ==, FSCACHE_OP_ST_IN_PROGRESS);
David Howells952efe72009-04-03 16:42:39 +010041
David Howells5753c442009-11-19 18:11:19 +000042 fscache_stat(&fscache_n_op_enqueue);
43 switch (op->flags & FSCACHE_OP_TYPE) {
Tejun Heo8af7c122010-07-20 22:09:01 +020044 case FSCACHE_OP_ASYNC:
45 _debug("queue async");
David Howells5753c442009-11-19 18:11:19 +000046 atomic_inc(&op->usage);
Tejun Heo8af7c122010-07-20 22:09:01 +020047 if (!queue_work(fscache_op_wq, &op->work))
David Howells5753c442009-11-19 18:11:19 +000048 fscache_put_operation(op);
49 break;
David Howells5753c442009-11-19 18:11:19 +000050 case FSCACHE_OP_MYTHREAD:
51 _debug("queue for caller's attention");
52 break;
53 default:
Fabian Frederick36dfd112014-06-04 16:05:38 -070054 pr_err("Unexpected op type %lx", op->flags);
David Howells5753c442009-11-19 18:11:19 +000055 BUG();
56 break;
David Howells952efe72009-04-03 16:42:39 +010057 }
58}
59EXPORT_SYMBOL(fscache_enqueue_operation);
60
61/*
62 * start an op running
63 */
64static void fscache_run_op(struct fscache_object *object,
65 struct fscache_operation *op)
66{
David Howells9f105232012-12-20 21:52:35 +000067 ASSERTCMP(op->state, ==, FSCACHE_OP_ST_PENDING);
68
69 op->state = FSCACHE_OP_ST_IN_PROGRESS;
David Howells952efe72009-04-03 16:42:39 +010070 object->n_in_progress++;
71 if (test_and_clear_bit(FSCACHE_OP_WAITING, &op->flags))
72 wake_up_bit(&op->flags, FSCACHE_OP_WAITING);
73 if (op->processor)
74 fscache_enqueue_operation(op);
75 fscache_stat(&fscache_n_op_run);
76}
77
78/*
David Howells3c305982015-02-24 10:39:28 +000079 * report an unexpected submission
80 */
81static void fscache_report_unexpected_submission(struct fscache_object *object,
82 struct fscache_operation *op,
83 const struct fscache_state *ostate)
84{
85 static bool once_only;
86 struct fscache_operation *p;
87 unsigned n;
88
89 if (once_only)
90 return;
91 once_only = true;
92
93 kdebug("unexpected submission OP%x [OBJ%x %s]",
94 op->debug_id, object->debug_id, object->state->name);
95 kdebug("objstate=%s [%s]", object->state->name, ostate->name);
96 kdebug("objflags=%lx", object->flags);
97 kdebug("objevent=%lx [%lx]", object->events, object->event_mask);
98 kdebug("ops=%u inp=%u exc=%u",
99 object->n_ops, object->n_in_progress, object->n_exclusive);
100
101 if (!list_empty(&object->pending_ops)) {
102 n = 0;
103 list_for_each_entry(p, &object->pending_ops, pend_link) {
104 ASSERTCMP(p->object, ==, object);
105 kdebug("%p %p", op->processor, op->release);
106 n++;
107 }
108
109 kdebug("n=%u", n);
110 }
111
112 dump_stack();
113}
114
115/*
David Howells952efe72009-04-03 16:42:39 +0100116 * submit an exclusive operation for an object
117 * - other ops are excluded from running simultaneously with this one
118 * - this gets any extra refs it needs on an op
119 */
120int fscache_submit_exclusive_op(struct fscache_object *object,
121 struct fscache_operation *op)
122{
David Howells30ceec62015-02-24 10:05:27 +0000123 const struct fscache_state *ostate;
124 unsigned long flags;
David Howells8d763492012-12-05 13:34:48 +0000125 int ret;
126
David Howells952efe72009-04-03 16:42:39 +0100127 _enter("{OBJ%x OP%x},", object->debug_id, op->debug_id);
128
David Howells9f105232012-12-20 21:52:35 +0000129 ASSERTCMP(op->state, ==, FSCACHE_OP_ST_INITIALISED);
130 ASSERTCMP(atomic_read(&op->usage), >, 0);
131
David Howells952efe72009-04-03 16:42:39 +0100132 spin_lock(&object->lock);
133 ASSERTCMP(object->n_ops, >=, object->n_in_progress);
134 ASSERTCMP(object->n_ops, >=, object->n_exclusive);
David Howells5753c442009-11-19 18:11:19 +0000135 ASSERT(list_empty(&op->pend_link));
David Howells952efe72009-04-03 16:42:39 +0100136
David Howells30ceec62015-02-24 10:05:27 +0000137 ostate = object->state;
138 smp_rmb();
139
David Howells9f105232012-12-20 21:52:35 +0000140 op->state = FSCACHE_OP_ST_PENDING;
David Howells30ceec62015-02-24 10:05:27 +0000141 flags = READ_ONCE(object->flags);
142 if (unlikely(!(flags & BIT(FSCACHE_OBJECT_IS_LIVE)))) {
143 fscache_stat(&fscache_n_op_rejected);
144 op->state = FSCACHE_OP_ST_CANCELLED;
145 ret = -ENOBUFS;
146 } else if (unlikely(fscache_cache_is_broken(object))) {
147 op->state = FSCACHE_OP_ST_CANCELLED;
148 ret = -EIO;
149 } else if (flags & BIT(FSCACHE_OBJECT_IS_AVAILABLE)) {
David Howells952efe72009-04-03 16:42:39 +0100150 op->object = object;
151 object->n_ops++;
152 object->n_exclusive++; /* reads and writes must wait */
153
David Howells9f105232012-12-20 21:52:35 +0000154 if (object->n_in_progress > 0) {
David Howells952efe72009-04-03 16:42:39 +0100155 atomic_inc(&op->usage);
156 list_add_tail(&op->pend_link, &object->pending_ops);
157 fscache_stat(&fscache_n_op_pend);
158 } else if (!list_empty(&object->pending_ops)) {
159 atomic_inc(&op->usage);
160 list_add_tail(&op->pend_link, &object->pending_ops);
161 fscache_stat(&fscache_n_op_pend);
162 fscache_start_operations(object);
163 } else {
164 ASSERTCMP(object->n_in_progress, ==, 0);
165 fscache_run_op(object, op);
166 }
167
168 /* need to issue a new write op after this */
169 clear_bit(FSCACHE_OBJECT_PENDING_WRITE, &object->flags);
David Howells8d763492012-12-05 13:34:48 +0000170 ret = 0;
David Howells30ceec62015-02-24 10:05:27 +0000171 } else if (flags & BIT(FSCACHE_OBJECT_IS_LOOKED_UP)) {
David Howells952efe72009-04-03 16:42:39 +0100172 op->object = object;
173 object->n_ops++;
174 object->n_exclusive++; /* reads and writes must wait */
175 atomic_inc(&op->usage);
176 list_add_tail(&op->pend_link, &object->pending_ops);
177 fscache_stat(&fscache_n_op_pend);
David Howells8d763492012-12-05 13:34:48 +0000178 ret = 0;
David Howells952efe72009-04-03 16:42:39 +0100179 } else {
David Howells30ceec62015-02-24 10:05:27 +0000180 fscache_report_unexpected_submission(object, op, ostate);
181 op->state = FSCACHE_OP_ST_CANCELLED;
182 ret = -ENOBUFS;
David Howells952efe72009-04-03 16:42:39 +0100183 }
184
185 spin_unlock(&object->lock);
David Howells8d763492012-12-05 13:34:48 +0000186 return ret;
David Howells952efe72009-04-03 16:42:39 +0100187}
188
189/*
David Howells952efe72009-04-03 16:42:39 +0100190 * submit an operation for an object
191 * - objects may be submitted only in the following states:
192 * - during object creation (write ops may be submitted)
193 * - whilst the object is active
194 * - after an I/O error incurred in one of the two above states (op rejected)
195 * - this gets any extra refs it needs on an op
196 */
197int fscache_submit_op(struct fscache_object *object,
198 struct fscache_operation *op)
199{
David Howellscaaef692013-05-10 19:50:26 +0100200 const struct fscache_state *ostate;
David Howells30ceec62015-02-24 10:05:27 +0000201 unsigned long flags;
David Howells952efe72009-04-03 16:42:39 +0100202 int ret;
203
204 _enter("{OBJ%x OP%x},{%u}",
205 object->debug_id, op->debug_id, atomic_read(&op->usage));
206
David Howells9f105232012-12-20 21:52:35 +0000207 ASSERTCMP(op->state, ==, FSCACHE_OP_ST_INITIALISED);
David Howells952efe72009-04-03 16:42:39 +0100208 ASSERTCMP(atomic_read(&op->usage), >, 0);
209
210 spin_lock(&object->lock);
211 ASSERTCMP(object->n_ops, >=, object->n_in_progress);
212 ASSERTCMP(object->n_ops, >=, object->n_exclusive);
David Howells5753c442009-11-19 18:11:19 +0000213 ASSERT(list_empty(&op->pend_link));
David Howells952efe72009-04-03 16:42:39 +0100214
215 ostate = object->state;
216 smp_rmb();
217
David Howells9f105232012-12-20 21:52:35 +0000218 op->state = FSCACHE_OP_ST_PENDING;
David Howells30ceec62015-02-24 10:05:27 +0000219 flags = READ_ONCE(object->flags);
220 if (unlikely(!(flags & BIT(FSCACHE_OBJECT_IS_LIVE)))) {
221 fscache_stat(&fscache_n_op_rejected);
222 op->state = FSCACHE_OP_ST_CANCELLED;
223 ret = -ENOBUFS;
224 } else if (unlikely(fscache_cache_is_broken(object))) {
225 op->state = FSCACHE_OP_ST_CANCELLED;
226 ret = -EIO;
227 } else if (flags & BIT(FSCACHE_OBJECT_IS_AVAILABLE)) {
David Howells952efe72009-04-03 16:42:39 +0100228 op->object = object;
229 object->n_ops++;
230
231 if (object->n_exclusive > 0) {
232 atomic_inc(&op->usage);
233 list_add_tail(&op->pend_link, &object->pending_ops);
234 fscache_stat(&fscache_n_op_pend);
235 } else if (!list_empty(&object->pending_ops)) {
236 atomic_inc(&op->usage);
237 list_add_tail(&op->pend_link, &object->pending_ops);
238 fscache_stat(&fscache_n_op_pend);
239 fscache_start_operations(object);
240 } else {
241 ASSERTCMP(object->n_exclusive, ==, 0);
242 fscache_run_op(object, op);
243 }
244 ret = 0;
David Howells30ceec62015-02-24 10:05:27 +0000245 } else if (flags & BIT(FSCACHE_OBJECT_IS_LOOKED_UP)) {
David Howells952efe72009-04-03 16:42:39 +0100246 op->object = object;
247 object->n_ops++;
248 atomic_inc(&op->usage);
249 list_add_tail(&op->pend_link, &object->pending_ops);
250 fscache_stat(&fscache_n_op_pend);
251 ret = 0;
David Howells30ceec62015-02-24 10:05:27 +0000252 } else {
David Howells952efe72009-04-03 16:42:39 +0100253 fscache_report_unexpected_submission(object, op, ostate);
254 ASSERT(!fscache_object_is_active(object));
David Howells9f105232012-12-20 21:52:35 +0000255 op->state = FSCACHE_OP_ST_CANCELLED;
David Howells952efe72009-04-03 16:42:39 +0100256 ret = -ENOBUFS;
David Howells952efe72009-04-03 16:42:39 +0100257 }
258
259 spin_unlock(&object->lock);
260 return ret;
261}
262
263/*
264 * queue an object for withdrawal on error, aborting all following asynchronous
265 * operations
266 */
267void fscache_abort_object(struct fscache_object *object)
268{
269 _enter("{OBJ%x}", object->debug_id);
270
271 fscache_raise_event(object, FSCACHE_OBJECT_EV_ERROR);
272}
273
274/*
David Howellsdcfae322013-05-24 12:45:31 +0100275 * Jump start the operation processing on an object. The caller must hold
276 * object->lock.
David Howells952efe72009-04-03 16:42:39 +0100277 */
278void fscache_start_operations(struct fscache_object *object)
279{
280 struct fscache_operation *op;
281 bool stop = false;
282
283 while (!list_empty(&object->pending_ops) && !stop) {
284 op = list_entry(object->pending_ops.next,
285 struct fscache_operation, pend_link);
286
287 if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags)) {
288 if (object->n_in_progress > 0)
289 break;
290 stop = true;
291 }
292 list_del_init(&op->pend_link);
David Howells5753c442009-11-19 18:11:19 +0000293 fscache_run_op(object, op);
David Howells952efe72009-04-03 16:42:39 +0100294
295 /* the pending queue was holding a ref on the object */
296 fscache_put_operation(op);
297 }
298
299 ASSERTCMP(object->n_in_progress, <=, object->n_ops);
300
301 _debug("woke %d ops on OBJ%x",
302 object->n_in_progress, object->debug_id);
303}
304
305/*
David Howells5753c442009-11-19 18:11:19 +0000306 * cancel an operation that's pending on an object
307 */
David Howells91c7fbb2012-12-14 11:02:22 +0000308int fscache_cancel_op(struct fscache_operation *op,
309 void (*do_cancel)(struct fscache_operation *))
David Howells5753c442009-11-19 18:11:19 +0000310{
311 struct fscache_object *object = op->object;
312 int ret;
313
314 _enter("OBJ%x OP%x}", op->object->debug_id, op->debug_id);
315
David Howells9f105232012-12-20 21:52:35 +0000316 ASSERTCMP(op->state, >=, FSCACHE_OP_ST_PENDING);
317 ASSERTCMP(op->state, !=, FSCACHE_OP_ST_CANCELLED);
318 ASSERTCMP(atomic_read(&op->usage), >, 0);
319
David Howells5753c442009-11-19 18:11:19 +0000320 spin_lock(&object->lock);
321
322 ret = -EBUSY;
David Howells9f105232012-12-20 21:52:35 +0000323 if (op->state == FSCACHE_OP_ST_PENDING) {
324 ASSERT(!list_empty(&op->pend_link));
David Howells5753c442009-11-19 18:11:19 +0000325 fscache_stat(&fscache_n_op_cancelled);
326 list_del_init(&op->pend_link);
David Howells91c7fbb2012-12-14 11:02:22 +0000327 if (do_cancel)
328 do_cancel(op);
David Howells9f105232012-12-20 21:52:35 +0000329 op->state = FSCACHE_OP_ST_CANCELLED;
David Howells5753c442009-11-19 18:11:19 +0000330 if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags))
331 object->n_exclusive--;
332 if (test_and_clear_bit(FSCACHE_OP_WAITING, &op->flags))
333 wake_up_bit(&op->flags, FSCACHE_OP_WAITING);
334 fscache_put_operation(op);
335 ret = 0;
336 }
337
338 spin_unlock(&object->lock);
339 _leave(" = %d", ret);
340 return ret;
341}
342
343/*
David Howellsef778e72012-12-20 21:52:36 +0000344 * Cancel all pending operations on an object
345 */
346void fscache_cancel_all_ops(struct fscache_object *object)
347{
348 struct fscache_operation *op;
349
350 _enter("OBJ%x", object->debug_id);
351
352 spin_lock(&object->lock);
353
354 while (!list_empty(&object->pending_ops)) {
355 op = list_entry(object->pending_ops.next,
356 struct fscache_operation, pend_link);
357 fscache_stat(&fscache_n_op_cancelled);
358 list_del_init(&op->pend_link);
359
360 ASSERTCMP(op->state, ==, FSCACHE_OP_ST_PENDING);
361 op->state = FSCACHE_OP_ST_CANCELLED;
362
363 if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags))
364 object->n_exclusive--;
365 if (test_and_clear_bit(FSCACHE_OP_WAITING, &op->flags))
366 wake_up_bit(&op->flags, FSCACHE_OP_WAITING);
367 fscache_put_operation(op);
368 cond_resched_lock(&object->lock);
369 }
370
371 spin_unlock(&object->lock);
372 _leave("");
373}
374
375/*
David Howells1f372df2012-12-13 20:03:13 +0000376 * Record the completion or cancellation of an in-progress operation.
David Howells9f105232012-12-20 21:52:35 +0000377 */
David Howells1f372df2012-12-13 20:03:13 +0000378void fscache_op_complete(struct fscache_operation *op, bool cancelled)
David Howells9f105232012-12-20 21:52:35 +0000379{
380 struct fscache_object *object = op->object;
381
382 _enter("OBJ%x", object->debug_id);
383
384 ASSERTCMP(op->state, ==, FSCACHE_OP_ST_IN_PROGRESS);
385 ASSERTCMP(object->n_in_progress, >, 0);
386 ASSERTIFCMP(test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags),
387 object->n_exclusive, >, 0);
388 ASSERTIFCMP(test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags),
389 object->n_in_progress, ==, 1);
390
391 spin_lock(&object->lock);
392
David Howells1f372df2012-12-13 20:03:13 +0000393 op->state = cancelled ?
394 FSCACHE_OP_ST_CANCELLED : FSCACHE_OP_ST_COMPLETE;
David Howells9f105232012-12-20 21:52:35 +0000395
396 if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags))
397 object->n_exclusive--;
398 object->n_in_progress--;
399 if (object->n_in_progress == 0)
400 fscache_start_operations(object);
401
402 spin_unlock(&object->lock);
403 _leave("");
404}
405EXPORT_SYMBOL(fscache_op_complete);
406
407/*
David Howells952efe72009-04-03 16:42:39 +0100408 * release an operation
409 * - queues pending ops if this is the last in-progress op
410 */
411void fscache_put_operation(struct fscache_operation *op)
412{
413 struct fscache_object *object;
414 struct fscache_cache *cache;
415
416 _enter("{OBJ%x OP%x,%d}",
417 op->object->debug_id, op->debug_id, atomic_read(&op->usage));
418
419 ASSERTCMP(atomic_read(&op->usage), >, 0);
420
421 if (!atomic_dec_and_test(&op->usage))
422 return;
423
424 _debug("PUT OP");
David Howells9f105232012-12-20 21:52:35 +0000425 ASSERTIFCMP(op->state != FSCACHE_OP_ST_COMPLETE,
426 op->state, ==, FSCACHE_OP_ST_CANCELLED);
427 op->state = FSCACHE_OP_ST_DEAD;
David Howells952efe72009-04-03 16:42:39 +0100428
429 fscache_stat(&fscache_n_op_release);
430
431 if (op->release) {
432 op->release(op);
433 op->release = NULL;
434 }
435
436 object = op->object;
437
David Howells13627292013-05-10 19:50:26 +0100438 if (test_bit(FSCACHE_OP_DEC_READ_CNT, &op->flags))
439 atomic_dec(&object->n_reads);
440 if (test_bit(FSCACHE_OP_UNUSE_COOKIE, &op->flags))
441 fscache_unuse_cookie(object);
David Howells4fbf4292009-11-19 18:11:04 +0000442
David Howells952efe72009-04-03 16:42:39 +0100443 /* now... we may get called with the object spinlock held, so we
444 * complete the cleanup here only if we can immediately acquire the
445 * lock, and defer it otherwise */
446 if (!spin_trylock(&object->lock)) {
447 _debug("defer put");
448 fscache_stat(&fscache_n_op_deferred_release);
449
450 cache = object->cache;
451 spin_lock(&cache->op_gc_list_lock);
452 list_add_tail(&op->pend_link, &cache->op_gc_list);
453 spin_unlock(&cache->op_gc_list_lock);
454 schedule_work(&cache->op_gc);
455 _leave(" [defer]");
456 return;
457 }
458
David Howells952efe72009-04-03 16:42:39 +0100459 ASSERTCMP(object->n_ops, >, 0);
460 object->n_ops--;
461 if (object->n_ops == 0)
462 fscache_raise_event(object, FSCACHE_OBJECT_EV_CLEARED);
463
464 spin_unlock(&object->lock);
465
466 kfree(op);
467 _leave(" [done]");
468}
469EXPORT_SYMBOL(fscache_put_operation);
470
471/*
472 * garbage collect operations that have had their release deferred
473 */
474void fscache_operation_gc(struct work_struct *work)
475{
476 struct fscache_operation *op;
477 struct fscache_object *object;
478 struct fscache_cache *cache =
479 container_of(work, struct fscache_cache, op_gc);
480 int count = 0;
481
482 _enter("");
483
484 do {
485 spin_lock(&cache->op_gc_list_lock);
486 if (list_empty(&cache->op_gc_list)) {
487 spin_unlock(&cache->op_gc_list_lock);
488 break;
489 }
490
491 op = list_entry(cache->op_gc_list.next,
492 struct fscache_operation, pend_link);
493 list_del(&op->pend_link);
494 spin_unlock(&cache->op_gc_list_lock);
495
496 object = op->object;
David Howells9f105232012-12-20 21:52:35 +0000497 spin_lock(&object->lock);
David Howells952efe72009-04-03 16:42:39 +0100498
499 _debug("GC DEFERRED REL OBJ%x OP%x",
500 object->debug_id, op->debug_id);
501 fscache_stat(&fscache_n_op_gc);
502
503 ASSERTCMP(atomic_read(&op->usage), ==, 0);
David Howells9f105232012-12-20 21:52:35 +0000504 ASSERTCMP(op->state, ==, FSCACHE_OP_ST_DEAD);
David Howells952efe72009-04-03 16:42:39 +0100505
506 ASSERTCMP(object->n_ops, >, 0);
507 object->n_ops--;
508 if (object->n_ops == 0)
509 fscache_raise_event(object, FSCACHE_OBJECT_EV_CLEARED);
510
511 spin_unlock(&object->lock);
David Howells9f105232012-12-20 21:52:35 +0000512 kfree(op);
David Howells952efe72009-04-03 16:42:39 +0100513
514 } while (count++ < 20);
515
516 if (!list_empty(&cache->op_gc_list))
517 schedule_work(&cache->op_gc);
518
519 _leave("");
520}
521
522/*
Tejun Heo8af7c122010-07-20 22:09:01 +0200523 * execute an operation using fs_op_wq to provide processing context -
524 * the caller holds a ref to this object, so we don't need to hold one
David Howells952efe72009-04-03 16:42:39 +0100525 */
Tejun Heo8af7c122010-07-20 22:09:01 +0200526void fscache_op_work_func(struct work_struct *work)
David Howells952efe72009-04-03 16:42:39 +0100527{
528 struct fscache_operation *op =
Tejun Heo8af7c122010-07-20 22:09:01 +0200529 container_of(work, struct fscache_operation, work);
David Howells952efe72009-04-03 16:42:39 +0100530 unsigned long start;
531
532 _enter("{OBJ%x OP%x,%d}",
533 op->object->debug_id, op->debug_id, atomic_read(&op->usage));
534
535 ASSERT(op->processor != NULL);
536 start = jiffies;
537 op->processor(op);
538 fscache_hist(fscache_ops_histogram, start);
Tejun Heo8af7c122010-07-20 22:09:01 +0200539 fscache_put_operation(op);
David Howells952efe72009-04-03 16:42:39 +0100540
541 _leave("");
542}