diff options
author | David Howells <dhowells@redhat.com> | 2013-08-21 17:29:38 -0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2013-09-06 04:17:30 -0400 |
commit | da9803bc8812f5bd3b26baaa90e515b843c65ff7 (patch) | |
tree | 889b39ec88863fb46606cf345eeb4fdf8a90a67e /include/linux/fscache.h | |
parent | 6e4664525b1db28f8c4e1130957f70a94c19213e (diff) |
FS-Cache: Add interface to check consistency of a cached object
Extend the fscache netfs API so that the netfs can ask as to whether a cache
object is up to date with respect to its corresponding netfs object:
int fscache_check_consistency(struct fscache_cookie *cookie)
This will call back to the netfs to check whether the auxiliary data associated
with a cookie is correct. It returns 0 if it is and -ESTALE if it isn't; it
may also return -ENOMEM and -ERESTARTSYS.
The backends now have to implement a mandatory operation pointer:
int (*check_consistency)(struct fscache_object *object)
that corresponds to the above API call. FS-Cache takes care of pinning the
object and the cookie in memory and managing this call with respect to the
object state.
Original-author: Hongyi Jia <jiayisuse@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Hongyi Jia <jiayisuse@gmail.com>
cc: Milosz Tanski <milosz@adfin.com>
Diffstat (limited to 'include/linux/fscache.h')
-rw-r--r-- | include/linux/fscache.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/fscache.h b/include/linux/fscache.h index 7a086235da4b..d984aff32a11 100644 --- a/include/linux/fscache.h +++ b/include/linux/fscache.h | |||
@@ -183,6 +183,7 @@ extern struct fscache_cookie *__fscache_acquire_cookie( | |||
183 | const struct fscache_cookie_def *, | 183 | const struct fscache_cookie_def *, |
184 | void *); | 184 | void *); |
185 | extern void __fscache_relinquish_cookie(struct fscache_cookie *, int); | 185 | extern void __fscache_relinquish_cookie(struct fscache_cookie *, int); |
186 | extern int __fscache_check_consistency(struct fscache_cookie *); | ||
186 | extern void __fscache_update_cookie(struct fscache_cookie *); | 187 | extern void __fscache_update_cookie(struct fscache_cookie *); |
187 | extern int __fscache_attr_changed(struct fscache_cookie *); | 188 | extern int __fscache_attr_changed(struct fscache_cookie *); |
188 | extern void __fscache_invalidate(struct fscache_cookie *); | 189 | extern void __fscache_invalidate(struct fscache_cookie *); |
@@ -326,6 +327,25 @@ void fscache_relinquish_cookie(struct fscache_cookie *cookie, int retire) | |||
326 | } | 327 | } |
327 | 328 | ||
328 | /** | 329 | /** |
330 | * fscache_check_consistency - Request that if the cache is updated | ||
331 | * @cookie: The cookie representing the cache object | ||
332 | * | ||
333 | * Request an consistency check from fscache, which passes the request | ||
334 | * to the backing cache. | ||
335 | * | ||
336 | * Returns 0 if consistent and -ESTALE if inconsistent. May also | ||
337 | * return -ENOMEM and -ERESTARTSYS. | ||
338 | */ | ||
339 | static inline | ||
340 | int fscache_check_consistency(struct fscache_cookie *cookie) | ||
341 | { | ||
342 | if (fscache_cookie_valid(cookie)) | ||
343 | return __fscache_check_consistency(cookie); | ||
344 | else | ||
345 | return 0; | ||
346 | } | ||
347 | |||
348 | /** | ||
329 | * fscache_update_cookie - Request that a cache object be updated | 349 | * fscache_update_cookie - Request that a cache object be updated |
330 | * @cookie: The cookie representing the cache object | 350 | * @cookie: The cookie representing the cache object |
331 | * | 351 | * |