diff options
author | David Howells <dhowells@redhat.com> | 2009-04-03 11:42:38 -0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2009-04-03 11:42:38 -0400 |
commit | 726dd7ff10c217dd74329c94643dc8ebea27334b (patch) | |
tree | 9bd5b011f945fca4f1b057f7e7750414b1fd9fbd /include/linux/fscache.h | |
parent | 955d00917f0c094e0f2fb88df967e980ab66b8ca (diff) |
FS-Cache: Add netfs registration
Add functions to register and unregister a network filesystem or other client
of the FS-Cache service. This allocates and releases the cookie representing
the top-level index for a netfs, and makes it available to the netfs.
If the FS-Cache facility is disabled, then the calls are optimised away at
compile time.
Note that whilst this patch may appear to work with FS-Cache enabled and a
netfs attempting to use it, it will leak the cookie it allocates for the netfs
as fscache_relinquish_cookie() is implemented in a later patch. This will
cause the slab code to emit a warning when the module is removed.
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Steve Dickson <steved@redhat.com>
Acked-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Acked-by: Al Viro <viro@zeniv.linux.org.uk>
Tested-by: Daire Byrne <Daire.Byrne@framestore.com>
Diffstat (limited to 'include/linux/fscache.h')
-rw-r--r-- | include/linux/fscache.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/include/linux/fscache.h b/include/linux/fscache.h index 9584c094d69f..b195c2e1ef6a 100644 --- a/include/linux/fscache.h +++ b/include/linux/fscache.h | |||
@@ -173,6 +173,8 @@ struct fscache_netfs { | |||
173 | * - these are undefined symbols when FS-Cache is not configured and the | 173 | * - these are undefined symbols when FS-Cache is not configured and the |
174 | * optimiser takes care of not using them | 174 | * optimiser takes care of not using them |
175 | */ | 175 | */ |
176 | extern int __fscache_register_netfs(struct fscache_netfs *); | ||
177 | extern void __fscache_unregister_netfs(struct fscache_netfs *); | ||
176 | extern struct fscache_cache_tag *__fscache_lookup_cache_tag(const char *); | 178 | extern struct fscache_cache_tag *__fscache_lookup_cache_tag(const char *); |
177 | extern void __fscache_release_cache_tag(struct fscache_cache_tag *); | 179 | extern void __fscache_release_cache_tag(struct fscache_cache_tag *); |
178 | 180 | ||
@@ -188,7 +190,10 @@ extern void __fscache_release_cache_tag(struct fscache_cache_tag *); | |||
188 | static inline | 190 | static inline |
189 | int fscache_register_netfs(struct fscache_netfs *netfs) | 191 | int fscache_register_netfs(struct fscache_netfs *netfs) |
190 | { | 192 | { |
191 | return 0; | 193 | if (fscache_available()) |
194 | return __fscache_register_netfs(netfs); | ||
195 | else | ||
196 | return 0; | ||
192 | } | 197 | } |
193 | 198 | ||
194 | /** | 199 | /** |
@@ -205,6 +210,8 @@ int fscache_register_netfs(struct fscache_netfs *netfs) | |||
205 | static inline | 210 | static inline |
206 | void fscache_unregister_netfs(struct fscache_netfs *netfs) | 211 | void fscache_unregister_netfs(struct fscache_netfs *netfs) |
207 | { | 212 | { |
213 | if (fscache_available()) | ||
214 | __fscache_unregister_netfs(netfs); | ||
208 | } | 215 | } |
209 | 216 | ||
210 | /** | 217 | /** |