]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - include/linux/fscache.h
FS-Cache: Add interface to check consistency of a cached object
[karo-tx-linux.git] / include / linux / fscache.h
index 7a086235da4be1ab94a026e0a1be3728dc1304a7..d984aff32a117476cadb10286e9cd31fb0bea94b 100644 (file)
@@ -183,6 +183,7 @@ extern struct fscache_cookie *__fscache_acquire_cookie(
        const struct fscache_cookie_def *,
        void *);
 extern void __fscache_relinquish_cookie(struct fscache_cookie *, int);
+extern int __fscache_check_consistency(struct fscache_cookie *);
 extern void __fscache_update_cookie(struct fscache_cookie *);
 extern int __fscache_attr_changed(struct fscache_cookie *);
 extern void __fscache_invalidate(struct fscache_cookie *);
@@ -325,6 +326,25 @@ void fscache_relinquish_cookie(struct fscache_cookie *cookie, int retire)
                __fscache_relinquish_cookie(cookie, retire);
 }
 
+/**
+ * fscache_check_consistency - Request that if the cache is updated
+ * @cookie: The cookie representing the cache object
+ *
+ * Request an consistency check from fscache, which passes the request
+ * to the backing cache.
+ *
+ * Returns 0 if consistent and -ESTALE if inconsistent.  May also
+ * return -ENOMEM and -ERESTARTSYS.
+ */
+static inline
+int fscache_check_consistency(struct fscache_cookie *cookie)
+{
+       if (fscache_cookie_valid(cookie))
+               return __fscache_check_consistency(cookie);
+       else
+               return 0;
+}
+
 /**
  * fscache_update_cookie - Request that a cache object be updated
  * @cookie: The cookie representing the cache object