aboutsummaryrefslogtreecommitdiff
path: root/fs/fscache
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2012-12-13 20:03:13 +0000
committerDavid Howells <dhowells@redhat.com>2012-12-20 22:34:00 +0000
commit1f372dff1da37e2b36ae9085368fa46896398598 (patch)
treef47b00dc61c9cf6c0eaa6d437bd7f91bfcb4d76d /fs/fscache
parent7ef001e937e8b9cbedb2fc1c31dd681ac3b31927 (diff)
FS-Cache: Mark cancellation of in-progress operation
Mark as cancelled an operation that is in progress rather than pending at the time it is cancelled, and call fscache_complete_op() to cancel an operation so that blocked ops can be started. Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'fs/fscache')
-rw-r--r--fs/fscache/operation.c7
-rw-r--r--fs/fscache/page.c10
2 files changed, 9 insertions, 8 deletions
diff --git a/fs/fscache/operation.c b/fs/fscache/operation.c
index 9e6b7d232bb..36c59604130 100644
--- a/fs/fscache/operation.c
+++ b/fs/fscache/operation.c
@@ -363,9 +363,9 @@ void fscache_cancel_all_ops(struct fscache_object *object)
}
/*
- * Record the completion of an in-progress operation.
+ * Record the completion or cancellation of an in-progress operation.
*/
-void fscache_op_complete(struct fscache_operation *op)
+void fscache_op_complete(struct fscache_operation *op, bool cancelled)
{
struct fscache_object *object = op->object;
@@ -380,7 +380,8 @@ void fscache_op_complete(struct fscache_operation *op)
spin_lock(&object->lock);
- op->state = FSCACHE_OP_ST_COMPLETE;
+ op->state = cancelled ?
+ FSCACHE_OP_ST_CANCELLED : FSCACHE_OP_ST_COMPLETE;
if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags))
object->n_exclusive--;
diff --git a/fs/fscache/page.c b/fs/fscache/page.c
index ef0218f5080..8a92b9fabe8 100644
--- a/fs/fscache/page.c
+++ b/fs/fscache/page.c
@@ -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("");
}
@@ -704,7 +704,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 +717,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 +755,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 +770,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("");
}