Merge tag 'v4.4.12' into linux-linaro-lsk-v4.4
[firefly-linux-kernel-4.4.55.git] / include / linux / fscache-cache.h
index 2e83a141e465c3e59e91a615e3c1ad2e9aa3fa35..604e1526cd00a23e27d6a426c8baa6a71bc309c2 100644 (file)
@@ -74,6 +74,7 @@ extern wait_queue_head_t fscache_cache_cleared_wq;
  */
 typedef void (*fscache_operation_release_t)(struct fscache_operation *op);
 typedef void (*fscache_operation_processor_t)(struct fscache_operation *op);
+typedef void (*fscache_operation_cancel_t)(struct fscache_operation *op);
 
 enum fscache_operation_state {
        FSCACHE_OP_ST_BLANK,            /* Op is not yet submitted */
@@ -109,6 +110,9 @@ struct fscache_operation {
         *   the op in a non-pool thread */
        fscache_operation_processor_t processor;
 
+       /* Operation cancellation cleanup (optional) */
+       fscache_operation_cancel_t cancel;
+
        /* operation releaser */
        fscache_operation_release_t release;
 };
@@ -119,33 +123,17 @@ extern void fscache_op_work_func(struct work_struct *work);
 extern void fscache_enqueue_operation(struct fscache_operation *);
 extern void fscache_op_complete(struct fscache_operation *, bool);
 extern void fscache_put_operation(struct fscache_operation *);
-
-/**
- * fscache_operation_init - Do basic initialisation of an operation
- * @op: The operation to initialise
- * @release: The release function to assign
- *
- * Do basic initialisation of an operation.  The caller must still set flags,
- * object and processor if needed.
- */
-static inline void fscache_operation_init(struct fscache_operation *op,
-                                       fscache_operation_processor_t processor,
-                                       fscache_operation_release_t release)
-{
-       INIT_WORK(&op->work, fscache_op_work_func);
-       atomic_set(&op->usage, 1);
-       op->state = FSCACHE_OP_ST_INITIALISED;
-       op->debug_id = atomic_inc_return(&fscache_op_debug_id);
-       op->processor = processor;
-       op->release = release;
-       INIT_LIST_HEAD(&op->pend_link);
-}
+extern void fscache_operation_init(struct fscache_operation *,
+                                  fscache_operation_processor_t,
+                                  fscache_operation_cancel_t,
+                                  fscache_operation_release_t);
 
 /*
  * data read operation
  */
 struct fscache_retrieval {
        struct fscache_operation op;
+       struct fscache_cookie   *cookie;        /* The netfs cookie */
        struct address_space    *mapping;       /* netfs pages */
        fscache_rw_complete_t   end_io_func;    /* function to call on I/O completion */
        void                    *context;       /* netfs read context (pinned) */
@@ -423,12 +411,6 @@ static inline bool fscache_object_is_active(struct fscache_object *object)
                !fscache_cache_is_broken(object);
 }
 
-static inline bool fscache_object_is_dead(struct fscache_object *object)
-{
-       return fscache_object_is_dying(object) &&
-               fscache_cache_is_broken(object);
-}
-
 /**
  * fscache_object_destroyed - Note destruction of an object in a cache
  * @cache: The cache from which the object came