PMIC:rk818.dtsi: remove rk818_reg_ldo2 aways-on,
[firefly-linux-kernel-4.4.55.git] / fs / fscache / page.c
index ef0218f5080d869f6dcd84385a9c3b0af161575b..ff000e52072d171258b0bb59e5e0efd560329ce9 100644 (file)
@@ -171,7 +171,7 @@ static void fscache_attr_changed_op(struct fscache_operation *op)
                        fscache_abort_object(object);
        }
 
-       fscache_op_complete(op);
+       fscache_op_complete(op, true);
        _leave("");
 }
 
@@ -302,6 +302,17 @@ static int fscache_wait_for_deferred_lookup(struct fscache_cookie *cookie)
        return 0;
 }
 
+/*
+ * Handle cancellation of a pending retrieval op
+ */
+static void fscache_do_cancel_retrieval(struct fscache_operation *_op)
+{
+       struct fscache_retrieval *op =
+               container_of(_op, struct fscache_retrieval, op);
+
+       op->n_pages = 0;
+}
+
 /*
  * wait for an object to become active (or dead)
  */
@@ -320,7 +331,7 @@ static int fscache_wait_for_retrieval_activation(struct fscache_object *object,
        if (wait_on_bit(&op->op.flags, FSCACHE_OP_WAITING,
                        fscache_wait_bit_interruptible,
                        TASK_INTERRUPTIBLE) != 0) {
-               ret = fscache_cancel_op(&op->op);
+               ret = fscache_cancel_op(&op->op, fscache_do_cancel_retrieval);
                if (ret == 0)
                        return -ERESTARTSYS;
 
@@ -338,8 +349,8 @@ check_if_dead:
                return -ENOBUFS;
        }
        if (unlikely(fscache_object_is_dead(object))) {
-               pr_err("%s() = -ENOBUFS [obj dead %d]", __func__, op->op.state);
-               fscache_cancel_op(&op->op);
+               pr_err("%s() = -ENOBUFS [obj dead %d]\n", __func__, op->op.state);
+               fscache_cancel_op(&op->op, fscache_do_cancel_retrieval);
                fscache_stat(stat_object_dead);
                return -ENOBUFS;
        }
@@ -704,7 +715,7 @@ static void fscache_write_op(struct fscache_operation *_op)
                 * exists, so we should just cancel this write operation.
                 */
                spin_unlock(&object->lock);
-               op->op.state = FSCACHE_OP_ST_CANCELLED;
+               fscache_op_complete(&op->op, false);
                _leave(" [inactive]");
                return;
        }
@@ -717,7 +728,7 @@ static void fscache_write_op(struct fscache_operation *_op)
                 * cancel this write operation.
                 */
                spin_unlock(&object->lock);
-               op->op.state = FSCACHE_OP_ST_CANCELLED;
+               fscache_op_complete(&op->op, false);
                _leave(" [cancel] op{f=%lx s=%u} obj{s=%u f=%lx}",
                       _op->flags, _op->state, object->state, object->flags);
                return;
@@ -755,7 +766,7 @@ static void fscache_write_op(struct fscache_operation *_op)
        fscache_end_page_write(object, page);
        if (ret < 0) {
                fscache_abort_object(object);
-               fscache_op_complete(&op->op);
+               fscache_op_complete(&op->op, true);
        } else {
                fscache_enqueue_operation(&op->op);
        }
@@ -770,7 +781,7 @@ superseded:
        spin_unlock(&cookie->stores_lock);
        clear_bit(FSCACHE_OBJECT_PENDING_WRITE, &object->flags);
        spin_unlock(&object->lock);
-       fscache_op_complete(&op->op);
+       fscache_op_complete(&op->op, true);
        _leave("");
 }