]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - include/linux/sunrpc/cache.h
Merge tag 'nfs-for-4.11-1' of git://git.linux-nfs.org/projects/anna/linux-nfs
[karo-tx-linux.git] / include / linux / sunrpc / cache.h
index bb5c9c80f12ea5c1473128098c9b9c81ac3ada85..270bad0e1bed137e9ce44727d9d79fde830e0006 100644 (file)
@@ -189,14 +189,17 @@ static inline struct cache_head  *cache_get(struct cache_head *h)
 
 static inline void cache_put(struct cache_head *h, struct cache_detail *cd)
 {
-       if (atomic_read(&h->ref.refcount) <= 2 &&
+       if (kref_read(&h->ref) <= 2 &&
            h->expiry_time < cd->nextcheck)
                cd->nextcheck = h->expiry_time;
        kref_put(&h->ref, cd->cache_put);
 }
 
-static inline int cache_is_expired(struct cache_detail *detail, struct cache_head *h)
+static inline bool cache_is_expired(struct cache_detail *detail, struct cache_head *h)
 {
+       if (!test_bit(CACHE_VALID, &h->flags))
+               return false;
+
        return  (h->expiry_time < seconds_since_boot()) ||
                (detail->flush_time >= h->last_refresh);
 }
@@ -218,6 +221,7 @@ extern void sunrpc_destroy_cache_detail(struct cache_detail *cd);
 extern int sunrpc_cache_register_pipefs(struct dentry *parent, const char *,
                                        umode_t, struct cache_detail *);
 extern void sunrpc_cache_unregister_pipefs(struct cache_detail *);
+extern void sunrpc_cache_unhash(struct cache_detail *, struct cache_head *);
 
 /* Must store cache_detail in seq_file->private if using next three functions */
 extern void *cache_seq_start(struct seq_file *file, loff_t *pos);