summaryrefslogtreecommitdiff
path: root/include/linux/fscache-cache.h
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2015-02-24 13:05:27 +0300
committerDavid Howells <dhowells@redhat.com>2015-04-02 16:28:53 +0300
commit30ceec6284129662efc3a1e7675b2bd857a046fe (patch)
tree98fba830445abbf24eb3fc969564fc20e29c04a8 /include/linux/fscache-cache.h
parent3c3059841a9b99fa8dd8d878607deceec1e363e9 (diff)
downloadlinux-30ceec6284129662efc3a1e7675b2bd857a046fe.tar.xz
FS-Cache: When submitting an op, cancel it if the target object is dying
When submitting an operation, prefer to cancel the operation immediately rather than queuing it for later processing if the object is marked as dying (ie. the object state machine has reached the KILL_OBJECT state). Whilst we're at it, change the series of related test_bit() calls into a READ_ONCE() and bitwise-AND operators to reduce the number of load instructions (test_bit() has a volatile address). Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Steve Dickson <steved@redhat.com> Acked-by: Jeff Layton <jeff.layton@primarydata.com>
Diffstat (limited to 'include/linux/fscache-cache.h')
-rw-r--r--include/linux/fscache-cache.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h
index c9dafdaf3347..2e83a141e465 100644
--- a/include/linux/fscache-cache.h
+++ b/include/linux/fscache-cache.h
@@ -411,17 +411,22 @@ static inline bool fscache_object_is_available(struct fscache_object *object)
return test_bit(FSCACHE_OBJECT_IS_AVAILABLE, &object->flags);
}
+static inline bool fscache_cache_is_broken(struct fscache_object *object)
+{
+ return test_bit(FSCACHE_IOERROR, &object->cache->flags);
+}
+
static inline bool fscache_object_is_active(struct fscache_object *object)
{
return fscache_object_is_available(object) &&
fscache_object_is_live(object) &&
- !test_bit(FSCACHE_IOERROR, &object->cache->flags);
+ !fscache_cache_is_broken(object);
}
static inline bool fscache_object_is_dead(struct fscache_object *object)
{
return fscache_object_is_dying(object) &&
- test_bit(FSCACHE_IOERROR, &object->cache->flags);
+ fscache_cache_is_broken(object);
}
/**