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>
diff --git a/fs/fscache/operation.c b/fs/fscache/operation.c
index 9e6b7d2..36c5960 100644
--- a/fs/fscache/operation.c
+++ b/fs/fscache/operation.c
@@ -363,9 +363,9 @@
}
/*
- * 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 @@
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--;