]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/sunrpc/cache.h
Merge branch 'from-tomtucker' into for-2.6.26
[linux-2.6-omap-h63xx.git] / include / linux / sunrpc / cache.h
index b5612c958ccef64d5437ca3f89dd7dd425023d58..2d8b211b9324a2bed283048161472d57b13a5977 100644 (file)
@@ -120,7 +120,6 @@ struct cache_deferred_req {
        struct list_head        hash;   /* on hash chain */
        struct list_head        recent; /* on fifo */
        struct cache_head       *item;  /* cache item we wait on */
-       time_t                  recv_time;
        void                    *owner; /* we might need to discard all defered requests
                                         * owned by someone */
        void                    (*revisit)(struct cache_deferred_req *req,
@@ -136,16 +135,6 @@ sunrpc_cache_update(struct cache_detail *detail,
                    struct cache_head *new, struct cache_head *old, int hash);
 
 
-#define cache_for_each(pos, detail, index, member)                                             \
-       for (({read_lock(&(detail)->hash_lock); index = (detail)->hash_size;}) ;                \
-            ({if (index==0)read_unlock(&(detail)->hash_lock); index--;});                      \
-               )                                                                               \
-               for (pos = container_of((detail)->hash_table[index], typeof(*pos), member);     \
-                    &pos->member;                                                              \
-                    pos = container_of(pos->member.next, typeof(*pos), member))
-
-            
-
 extern void cache_clean_deferred(void *owner);
 
 static inline struct cache_head  *cache_get(struct cache_head *h)
@@ -163,13 +152,24 @@ static inline void cache_put(struct cache_head *h, struct cache_detail *cd)
        kref_put(&h->ref, cd->cache_put);
 }
 
+static inline int cache_valid(struct cache_head *h)
+{
+       /* If an item has been unhashed pending removal when
+        * the refcount drops to 0, the expiry_time will be
+        * set to 0.  We don't want to consider such items
+        * valid in this context even though CACHE_VALID is
+        * set.
+        */
+       return (h->expiry_time != 0 && test_bit(CACHE_VALID, &h->flags));
+}
+
 extern int cache_check(struct cache_detail *detail,
                       struct cache_head *h, struct cache_req *rqstp);
 extern void cache_flush(void);
 extern void cache_purge(struct cache_detail *detail);
 #define NEVER (0x7FFFFFFF)
-extern void cache_register(struct cache_detail *cd);
-extern int cache_unregister(struct cache_detail *cd);
+extern int cache_register(struct cache_detail *cd);
+extern void cache_unregister(struct cache_detail *cd);
 
 extern void qword_add(char **bpp, int *lp, char *str);
 extern void qword_addhex(char **bpp, int *lp, char *buf, int blen);