aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/linux/nfsd/export.h4
-rw-r--r--include/linux/sunrpc/cache.h13
2 files changed, 7 insertions, 10 deletions
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index d52e0b7ad37b..a6c08a47b25c 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -102,13 +102,11 @@ int exp_rootfh(struct auth_domain *,
102int exp_pseudoroot(struct auth_domain *, struct svc_fh *fhp, struct cache_req *creq); 102int exp_pseudoroot(struct auth_domain *, struct svc_fh *fhp, struct cache_req *creq);
103int nfserrno(int errno); 103int nfserrno(int errno);
104 104
105extern void expkey_put(struct cache_head *item, struct cache_detail *cd);
106extern void svc_export_put(struct cache_head *item, struct cache_detail *cd);
107extern struct cache_detail svc_export_cache, svc_expkey_cache; 105extern struct cache_detail svc_export_cache, svc_expkey_cache;
108 106
109static inline void exp_put(struct svc_export *exp) 107static inline void exp_put(struct svc_export *exp)
110{ 108{
111 svc_export_put(&exp->h, &svc_export_cache); 109 cache_put(&exp->h, &svc_export_cache);
112} 110}
113 111
114static inline void exp_get(struct svc_export *exp) 112static inline void exp_get(struct svc_export *exp)
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index a37fead1873b..ad3f5cbdb770 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -50,7 +50,7 @@ struct cache_head {
50 time_t last_refresh; /* If CACHE_PENDING, this is when upcall 50 time_t last_refresh; /* If CACHE_PENDING, this is when upcall
51 * was sent, else this is when update was received 51 * was sent, else this is when update was received
52 */ 52 */
53 atomic_t refcnt; 53 struct kref ref;
54 unsigned long flags; 54 unsigned long flags;
55}; 55};
56#define CACHE_VALID 0 /* Entry contains valid data */ 56#define CACHE_VALID 0 /* Entry contains valid data */
@@ -68,8 +68,7 @@ struct cache_detail {
68 atomic_t inuse; /* active user-space update or lookup */ 68 atomic_t inuse; /* active user-space update or lookup */
69 69
70 char *name; 70 char *name;
71 void (*cache_put)(struct cache_head *, 71 void (*cache_put)(struct kref *);
72 struct cache_detail*);
73 72
74 void (*cache_request)(struct cache_detail *cd, 73 void (*cache_request)(struct cache_detail *cd,
75 struct cache_head *h, 74 struct cache_head *h,
@@ -151,17 +150,17 @@ extern void cache_clean_deferred(void *owner);
151 150
152static inline struct cache_head *cache_get(struct cache_head *h) 151static inline struct cache_head *cache_get(struct cache_head *h)
153{ 152{
154 atomic_inc(&h->refcnt); 153 kref_get(&h->ref);
155 return h; 154 return h;
156} 155}
157 156
158 157
159static inline int cache_put(struct cache_head *h, struct cache_detail *cd) 158static inline void cache_put(struct cache_head *h, struct cache_detail *cd)
160{ 159{
161 if (atomic_read(&h->refcnt) <= 2 && 160 if (atomic_read(&h->ref.refcount) <= 2 &&
162 h->expiry_time < cd->nextcheck) 161 h->expiry_time < cd->nextcheck)
163 cd->nextcheck = h->expiry_time; 162 cd->nextcheck = h->expiry_time;
164 return atomic_dec_and_test(&h->refcnt); 163 kref_put(&h->ref, cd->cache_put);
165} 164}
166 165
167extern void cache_init(struct cache_head *h); 166extern void cache_init(struct cache_head *h);