These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / include / linux / sunrpc / cache.h
index 437ddb6..ed03c9f 100644 (file)
  * 
  */
 struct cache_head {
-       struct cache_head * next;
+       struct hlist_node       cache_list;
        time_t          expiry_time;    /* After time time, don't use the data */
-       time_t          last_refresh;   /* If CACHE_PENDING, this is when upcall 
-                                        * was sent, else this is when update was received
+       time_t          last_refresh;   /* If CACHE_PENDING, this is when upcall was
+                                        * sent, else this is when update was
+                                        * received, though it is alway set to
+                                        * be *after* ->flush_time.
                                         */
        struct kref     ref;
        unsigned long   flags;
@@ -73,7 +75,7 @@ struct cache_detail_pipefs {
 struct cache_detail {
        struct module *         owner;
        int                     hash_size;
-       struct cache_head **    hash_table;
+       struct hlist_head *     hash_table;
        rwlock_t                hash_lock;
 
        atomic_t                inuse; /* active user-space update or lookup */
@@ -105,8 +107,12 @@ struct cache_detail {
        /* fields below this comment are for internal use
         * and should not be touched by cache owners
         */
-       time_t                  flush_time;             /* flush all cache items with last_refresh
-                                                        * earlier than this */
+       time_t                  flush_time;             /* flush all cache items with
+                                                        * last_refresh at or earlier
+                                                        * than this.  last_refresh
+                                                        * is never set at or earlier
+                                                        * than this.
+                                                        */
        struct list_head        others;
        time_t                  nextcheck;
        int                     entries;
@@ -203,7 +209,7 @@ static inline void cache_put(struct cache_head *h, struct cache_detail *cd)
 static inline int cache_is_expired(struct cache_detail *detail, struct cache_head *h)
 {
        return  (h->expiry_time < seconds_since_boot()) ||
-               (detail->flush_time > h->last_refresh);
+               (detail->flush_time >= h->last_refresh);
 }
 
 extern int cache_check(struct cache_detail *detail,
@@ -224,6 +230,11 @@ 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 *);
 
+/* 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);
+extern void *cache_seq_next(struct seq_file *file, void *p, loff_t *pos);
+extern void cache_seq_stop(struct seq_file *file, void *p);
+
 extern void qword_add(char **bpp, int *lp, char *str);
 extern void qword_addhex(char **bpp, int *lp, char *buf, int blen);
 extern int qword_get(char **bpp, char *dest, int bufsize);