diff options
author | David Howells <dhowells@redhat.com> | 2012-12-13 15:03:13 -0500 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2012-12-20 17:34:00 -0500 |
commit | 1f372dff1da37e2b36ae9085368fa46896398598 (patch) | |
tree | f47b00dc61c9cf6c0eaa6d437bd7f91bfcb4d76d /fs/fscache | |
parent | 7ef001e937e8b9cbedb2fc1c31dd681ac3b31927 (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.c | 7 | ||||
-rw-r--r-- | fs/fscache/page.c | 10 |
2 files changed, 9 insertions, 8 deletions
diff --git a/fs/fscache/operation.c b/fs/fscache/operation.c index 9e6b7d232bb1..36c59604130d 100644 --- a/fs/fscache/operation.c +++ b/fs/fscache/operation.c | |||
@@ -363,9 +363,9 @@ void fscache_cancel_all_ops(struct fscache_object *object) | |||
363 | } | 363 | } |
364 | 364 | ||
365 | /* | 365 | /* |
366 | * Record the completion of an in-progress operation. | 366 | * Record the completion or cancellation of an in-progress operation. |
367 | */ | 367 | */ |
368 | void fscache_op_complete(struct fscache_operation *op) | 368 | void fscache_op_complete(struct fscache_operation *op, bool cancelled) |
369 | { | 369 | { |
370 | struct fscache_object *object = op->object; | 370 | struct fscache_object *object = op->object; |
371 | 371 | ||
@@ -380,7 +380,8 @@ void fscache_op_complete(struct fscache_operation *op) | |||
380 | 380 | ||
381 | spin_lock(&object->lock); | 381 | spin_lock(&object->lock); |
382 | 382 | ||
383 | op->state = FSCACHE_OP_ST_COMPLETE; | 383 | op->state = cancelled ? |
384 | FSCACHE_OP_ST_CANCELLED : FSCACHE_OP_ST_COMPLETE; | ||
384 | 385 | ||
385 | if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags)) | 386 | if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags)) |
386 | object->n_exclusive--; | 387 | object->n_exclusive--; |
diff --git a/fs/fscache/page.c b/fs/fscache/page.c index ef0218f5080d..8a92b9fabe83 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) | |||
171 | fscache_abort_object(object); | 171 | fscache_abort_object(object); |
172 | } | 172 | } |
173 | 173 | ||
174 | fscache_op_complete(op); | 174 | fscache_op_complete(op, true); |
175 | _leave(""); | 175 | _leave(""); |
176 | } | 176 | } |
177 | 177 | ||
@@ -704,7 +704,7 @@ static void fscache_write_op(struct fscache_operation *_op) | |||
704 | * exists, so we should just cancel this write operation. | 704 | * exists, so we should just cancel this write operation. |
705 | */ | 705 | */ |
706 | spin_unlock(&object->lock); | 706 | spin_unlock(&object->lock); |
707 | op->op.state = FSCACHE_OP_ST_CANCELLED; | 707 | fscache_op_complete(&op->op, false); |
708 | _leave(" [inactive]"); | 708 | _leave(" [inactive]"); |
709 | return; | 709 | return; |
710 | } | 710 | } |
@@ -717,7 +717,7 @@ static void fscache_write_op(struct fscache_operation *_op) | |||
717 | * cancel this write operation. | 717 | * cancel this write operation. |
718 | */ | 718 | */ |
719 | spin_unlock(&object->lock); | 719 | spin_unlock(&object->lock); |
720 | op->op.state = FSCACHE_OP_ST_CANCELLED; | 720 | fscache_op_complete(&op->op, false); |
721 | _leave(" [cancel] op{f=%lx s=%u} obj{s=%u f=%lx}", | 721 | _leave(" [cancel] op{f=%lx s=%u} obj{s=%u f=%lx}", |
722 | _op->flags, _op->state, object->state, object->flags); | 722 | _op->flags, _op->state, object->state, object->flags); |
723 | return; | 723 | return; |
@@ -755,7 +755,7 @@ static void fscache_write_op(struct fscache_operation *_op) | |||
755 | fscache_end_page_write(object, page); | 755 | fscache_end_page_write(object, page); |
756 | if (ret < 0) { | 756 | if (ret < 0) { |
757 | fscache_abort_object(object); | 757 | fscache_abort_object(object); |
758 | fscache_op_complete(&op->op); | 758 | fscache_op_complete(&op->op, true); |
759 | } else { | 759 | } else { |
760 | fscache_enqueue_operation(&op->op); | 760 | fscache_enqueue_operation(&op->op); |
761 | } | 761 | } |
@@ -770,7 +770,7 @@ superseded: | |||
770 | spin_unlock(&cookie->stores_lock); | 770 | spin_unlock(&cookie->stores_lock); |
771 | clear_bit(FSCACHE_OBJECT_PENDING_WRITE, &object->flags); | 771 | clear_bit(FSCACHE_OBJECT_PENDING_WRITE, &object->flags); |
772 | spin_unlock(&object->lock); | 772 | spin_unlock(&object->lock); |
773 | fscache_op_complete(&op->op); | 773 | fscache_op_complete(&op->op, true); |
774 | _leave(""); | 774 | _leave(""); |
775 | } | 775 | } |
776 | 776 | ||