vserver 1.9.5.x5
[linux-2.6.git] / include / linux / sunrpc / cache.h
index 18c776d..b902425 100644 (file)
@@ -97,7 +97,9 @@ struct cache_detail {
        struct proc_dir_entry   *flush_ent, *channel_ent, *content_ent;
 
        atomic_t                readers;                /* how many time is /chennel open */
-       time_t                  last_close;             /* it no readers, when did last close */
+       time_t                  last_close;             /* if no readers, when did last close */
+       time_t                  last_warn;              /* when we last warned about no readers */
+       void                    (*warn_no_listener)(struct cache_detail *cd);
 };
 
 
@@ -159,6 +161,10 @@ struct cache_deferred_req {
  * INIT copies key information from "item" to "new"
  * UPDATE copies content information from "item" to "tmp"
  * INPLACE is true if updates can happen inplace rather than allocating a new structure
+ *
+ * WARNING: any substantial changes to this must be reflected in
+ *   net/sunrpc/svcauth.c(auth_domain_lookup)
+ *  which is a similar routine that is open-coded.
  */
 #define DefineCacheLookup(RTN,MEMBER,FNAME,ARGS,SETUP,DETAIL,HASHFN,TEST,INIT,UPDATE,INPLACE)  \
 RTN *FNAME ARGS                                                                                \
@@ -193,8 +199,11 @@ RTN *FNAME ARGS                                                                            \
                                        t2 = tmp; tmp = new; new = t2;                  \
                                }                                                       \
                                if (test_bit(CACHE_NEGATIVE,  &item->MEMBER.flags))     \
-                                        set_bit(CACHE_NEGATIVE, &tmp->MEMBER.flags);   \
-                               else {UPDATE;}                                          \
+                                       set_bit(CACHE_NEGATIVE, &tmp->MEMBER.flags);    \
+                               else {                                                  \
+                                       UPDATE;                                         \
+                                       clear_bit(CACHE_NEGATIVE, &tmp->MEMBER.flags);  \
+                               }                                                       \
                        }                                                               \
                        if (set||new) write_unlock(&(DETAIL)->hash_lock);               \
                        else read_unlock(&(DETAIL)->hash_lock);                         \
@@ -228,7 +237,6 @@ RTN *FNAME ARGS                                                                             \
        new = kmalloc(sizeof(*new), GFP_KERNEL);                                        \
        if (new) {                                                                      \
                cache_init(&new->MEMBER);                                               \
-               cache_get(&new->MEMBER);                                                \
                goto retry;                                                             \
        }                                                                               \
        return NULL;                                                                    \
@@ -249,8 +257,6 @@ RTN *FNAME ARGS                                                                             \
 
             
 
-extern void cache_defer_req(struct cache_req *req, struct cache_head *item);
-extern void cache_revisit_request(struct cache_head *item);
 extern void cache_clean_deferred(void *owner);
 
 static inline struct cache_head  *cache_get(struct cache_head *h)
@@ -278,14 +284,11 @@ extern void cache_fresh(struct cache_detail *detail,
                        struct cache_head *head, time_t expiry);
 extern int cache_check(struct cache_detail *detail,
                       struct cache_head *h, struct cache_req *rqstp);
-extern int cache_clean(void);
 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 struct cache_detail *cache_find(char *name);
-extern void cache_drop(struct cache_detail *detail);
 
 extern void qword_add(char **bpp, int *lp, char *str);
 extern void qword_addhex(char **bpp, int *lp, char *buf, int blen);