From 0e04d4cefcf4d8fbbdb2c50e93ad541582933fd2 Mon Sep 17 00:00:00 2001 From: David Howells Date: Fri, 3 Apr 2009 16:42:37 +0100 Subject: FS-Cache: Add cache tag handling Implement two features of FS-Cache: (1) The ability to request and release cache tags - names by which a cache may be known to a netfs, and thus selected for use. (2) An internal function by which a cache is selected by consulting the netfs, if the netfs wishes to be consulted. Signed-off-by: David Howells Acked-by: Steve Dickson Acked-by: Trond Myklebust Acked-by: Al Viro Tested-by: Daire Byrne --- include/linux/fscache.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/fscache.h b/include/linux/fscache.h index feb3b0e0af4d..9584c094d69f 100644 --- a/include/linux/fscache.h +++ b/include/linux/fscache.h @@ -173,6 +173,8 @@ struct fscache_netfs { * - these are undefined symbols when FS-Cache is not configured and the * optimiser takes care of not using them */ +extern struct fscache_cache_tag *__fscache_lookup_cache_tag(const char *); +extern void __fscache_release_cache_tag(struct fscache_cache_tag *); /** * fscache_register_netfs - Register a filesystem as desiring caching services @@ -218,7 +220,10 @@ void fscache_unregister_netfs(struct fscache_netfs *netfs) static inline struct fscache_cache_tag *fscache_lookup_cache_tag(const char *name) { - return NULL; + if (fscache_available()) + return __fscache_lookup_cache_tag(name); + else + return NULL; } /** @@ -233,6 +238,8 @@ struct fscache_cache_tag *fscache_lookup_cache_tag(const char *name) static inline void fscache_release_cache_tag(struct fscache_cache_tag *tag) { + if (fscache_available()) + __fscache_release_cache_tag(tag); } /** -- cgit v1.2.3-59-g8ed1b