diff options
Diffstat (limited to 'include/linux/fscache-cache.h')
-rw-r--r-- | include/linux/fscache-cache.h | 47 |
1 files changed, 17 insertions, 30 deletions
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h index c57db27ac861..b8581c09d19f 100644 --- a/include/linux/fscache-cache.h +++ b/include/linux/fscache-cache.h | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | #include <linux/fscache.h> | 21 | #include <linux/fscache.h> |
22 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
23 | #include <linux/slow-work.h> | 23 | #include <linux/workqueue.h> |
24 | 24 | ||
25 | #define NR_MAXCACHES BITS_PER_LONG | 25 | #define NR_MAXCACHES BITS_PER_LONG |
26 | 26 | ||
@@ -76,18 +76,14 @@ typedef void (*fscache_operation_release_t)(struct fscache_operation *op); | |||
76 | typedef void (*fscache_operation_processor_t)(struct fscache_operation *op); | 76 | typedef void (*fscache_operation_processor_t)(struct fscache_operation *op); |
77 | 77 | ||
78 | struct fscache_operation { | 78 | struct fscache_operation { |
79 | union { | 79 | struct work_struct work; /* record for async ops */ |
80 | struct work_struct fast_work; /* record for fast ops */ | ||
81 | struct slow_work slow_work; /* record for (very) slow ops */ | ||
82 | }; | ||
83 | struct list_head pend_link; /* link in object->pending_ops */ | 80 | struct list_head pend_link; /* link in object->pending_ops */ |
84 | struct fscache_object *object; /* object to be operated upon */ | 81 | struct fscache_object *object; /* object to be operated upon */ |
85 | 82 | ||
86 | unsigned long flags; | 83 | unsigned long flags; |
87 | #define FSCACHE_OP_TYPE 0x000f /* operation type */ | 84 | #define FSCACHE_OP_TYPE 0x000f /* operation type */ |
88 | #define FSCACHE_OP_FAST 0x0001 /* - fast op, processor may not sleep for disk */ | 85 | #define FSCACHE_OP_ASYNC 0x0001 /* - async op, processor may sleep for disk */ |
89 | #define FSCACHE_OP_SLOW 0x0002 /* - (very) slow op, processor may sleep for disk */ | 86 | #define FSCACHE_OP_MYTHREAD 0x0002 /* - processing is done be issuing thread, not pool */ |
90 | #define FSCACHE_OP_MYTHREAD 0x0003 /* - processing is done be issuing thread, not pool */ | ||
91 | #define FSCACHE_OP_WAITING 4 /* cleared when op is woken */ | 87 | #define FSCACHE_OP_WAITING 4 /* cleared when op is woken */ |
92 | #define FSCACHE_OP_EXCLUSIVE 5 /* exclusive op, other ops must wait */ | 88 | #define FSCACHE_OP_EXCLUSIVE 5 /* exclusive op, other ops must wait */ |
93 | #define FSCACHE_OP_DEAD 6 /* op is now dead */ | 89 | #define FSCACHE_OP_DEAD 6 /* op is now dead */ |
@@ -105,7 +101,8 @@ struct fscache_operation { | |||
105 | /* operation releaser */ | 101 | /* operation releaser */ |
106 | fscache_operation_release_t release; | 102 | fscache_operation_release_t release; |
107 | 103 | ||
108 | #ifdef CONFIG_SLOW_WORK_DEBUG | 104 | #ifdef CONFIG_WORKQUEUE_DEBUGFS |
105 | struct work_struct put_work; /* work to delay operation put */ | ||
109 | const char *name; /* operation name */ | 106 | const char *name; /* operation name */ |
110 | const char *state; /* operation state */ | 107 | const char *state; /* operation state */ |
111 | #define fscache_set_op_name(OP, N) do { (OP)->name = (N); } while(0) | 108 | #define fscache_set_op_name(OP, N) do { (OP)->name = (N); } while(0) |
@@ -117,7 +114,7 @@ struct fscache_operation { | |||
117 | }; | 114 | }; |
118 | 115 | ||
119 | extern atomic_t fscache_op_debug_id; | 116 | extern atomic_t fscache_op_debug_id; |
120 | extern const struct slow_work_ops fscache_op_slow_work_ops; | 117 | extern void fscache_op_work_func(struct work_struct *work); |
121 | 118 | ||
122 | extern void fscache_enqueue_operation(struct fscache_operation *); | 119 | extern void fscache_enqueue_operation(struct fscache_operation *); |
123 | extern void fscache_put_operation(struct fscache_operation *); | 120 | extern void fscache_put_operation(struct fscache_operation *); |
@@ -128,33 +125,21 @@ extern void fscache_put_operation(struct fscache_operation *); | |||
128 | * @release: The release function to assign | 125 | * @release: The release function to assign |
129 | * | 126 | * |
130 | * Do basic initialisation of an operation. The caller must still set flags, | 127 | * Do basic initialisation of an operation. The caller must still set flags, |
131 | * object, either fast_work or slow_work if necessary, and processor if needed. | 128 | * object and processor if needed. |
132 | */ | 129 | */ |
133 | static inline void fscache_operation_init(struct fscache_operation *op, | 130 | static inline void fscache_operation_init(struct fscache_operation *op, |
134 | fscache_operation_release_t release) | 131 | fscache_operation_processor_t processor, |
132 | fscache_operation_release_t release) | ||
135 | { | 133 | { |
134 | INIT_WORK(&op->work, fscache_op_work_func); | ||
136 | atomic_set(&op->usage, 1); | 135 | atomic_set(&op->usage, 1); |
137 | op->debug_id = atomic_inc_return(&fscache_op_debug_id); | 136 | op->debug_id = atomic_inc_return(&fscache_op_debug_id); |
137 | op->processor = processor; | ||
138 | op->release = release; | 138 | op->release = release; |
139 | INIT_LIST_HEAD(&op->pend_link); | 139 | INIT_LIST_HEAD(&op->pend_link); |
140 | fscache_set_op_state(op, "Init"); | 140 | fscache_set_op_state(op, "Init"); |
141 | } | 141 | } |
142 | 142 | ||
143 | /** | ||
144 | * fscache_operation_init_slow - Do additional initialisation of a slow op | ||
145 | * @op: The operation to initialise | ||
146 | * @processor: The processor function to assign | ||
147 | * | ||
148 | * Do additional initialisation of an operation as required for slow work. | ||
149 | */ | ||
150 | static inline | ||
151 | void fscache_operation_init_slow(struct fscache_operation *op, | ||
152 | fscache_operation_processor_t processor) | ||
153 | { | ||
154 | op->processor = processor; | ||
155 | slow_work_init(&op->slow_work, &fscache_op_slow_work_ops); | ||
156 | } | ||
157 | |||
158 | /* | 143 | /* |
159 | * data read operation | 144 | * data read operation |
160 | */ | 145 | */ |
@@ -389,7 +374,7 @@ struct fscache_object { | |||
389 | struct fscache_cache *cache; /* cache that supplied this object */ | 374 | struct fscache_cache *cache; /* cache that supplied this object */ |
390 | struct fscache_cookie *cookie; /* netfs's file/index object */ | 375 | struct fscache_cookie *cookie; /* netfs's file/index object */ |
391 | struct fscache_object *parent; /* parent object */ | 376 | struct fscache_object *parent; /* parent object */ |
392 | struct slow_work work; /* attention scheduling record */ | 377 | struct work_struct work; /* attention scheduling record */ |
393 | struct list_head dependents; /* FIFO of dependent objects */ | 378 | struct list_head dependents; /* FIFO of dependent objects */ |
394 | struct list_head dep_link; /* link in parent's dependents list */ | 379 | struct list_head dep_link; /* link in parent's dependents list */ |
395 | struct list_head pending_ops; /* unstarted operations on this object */ | 380 | struct list_head pending_ops; /* unstarted operations on this object */ |
@@ -411,7 +396,7 @@ extern const char *fscache_object_states[]; | |||
411 | (test_bit(FSCACHE_IOERROR, &(obj)->cache->flags) && \ | 396 | (test_bit(FSCACHE_IOERROR, &(obj)->cache->flags) && \ |
412 | (obj)->state >= FSCACHE_OBJECT_DYING) | 397 | (obj)->state >= FSCACHE_OBJECT_DYING) |
413 | 398 | ||
414 | extern const struct slow_work_ops fscache_object_slow_work_ops; | 399 | extern void fscache_object_work_func(struct work_struct *work); |
415 | 400 | ||
416 | /** | 401 | /** |
417 | * fscache_object_init - Initialise a cache object description | 402 | * fscache_object_init - Initialise a cache object description |
@@ -433,7 +418,7 @@ void fscache_object_init(struct fscache_object *object, | |||
433 | spin_lock_init(&object->lock); | 418 | spin_lock_init(&object->lock); |
434 | INIT_LIST_HEAD(&object->cache_link); | 419 | INIT_LIST_HEAD(&object->cache_link); |
435 | INIT_HLIST_NODE(&object->cookie_link); | 420 | INIT_HLIST_NODE(&object->cookie_link); |
436 | vslow_work_init(&object->work, &fscache_object_slow_work_ops); | 421 | INIT_WORK(&object->work, fscache_object_work_func); |
437 | INIT_LIST_HEAD(&object->dependents); | 422 | INIT_LIST_HEAD(&object->dependents); |
438 | INIT_LIST_HEAD(&object->dep_link); | 423 | INIT_LIST_HEAD(&object->dep_link); |
439 | INIT_LIST_HEAD(&object->pending_ops); | 424 | INIT_LIST_HEAD(&object->pending_ops); |
@@ -534,6 +519,8 @@ extern void fscache_io_error(struct fscache_cache *cache); | |||
534 | extern void fscache_mark_pages_cached(struct fscache_retrieval *op, | 519 | extern void fscache_mark_pages_cached(struct fscache_retrieval *op, |
535 | struct pagevec *pagevec); | 520 | struct pagevec *pagevec); |
536 | 521 | ||
522 | extern bool fscache_object_sleep_till_congested(signed long *timeoutp); | ||
523 | |||
537 | extern enum fscache_checkaux fscache_check_aux(struct fscache_object *object, | 524 | extern enum fscache_checkaux fscache_check_aux(struct fscache_object *object, |
538 | const void *data, | 525 | const void *data, |
539 | uint16_t datalen); | 526 | uint16_t datalen); |