aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2014-08-06 13:44:22 -0400
committerJ. Bruce Fields <bfields@redhat.com>2014-08-17 12:00:12 -0400
commit11acf6ef3b58abd1c5eb94eaa38ed3b9dbc387f7 (patch)
tree560ccca1947632495815d19ecfd8e81d1dc496d4
parentbedd4b61a46d0398192a08fbe6821d1ac65aba84 (diff)
nfsd: Remove the cache_hash list
Now that the lru list is per-bucket, we don't need a second list for searches. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r--fs/nfsd/cache.h1
-rw-r--r--fs/nfsd/nfscache.c19
2 files changed, 2 insertions, 18 deletions
diff --git a/fs/nfsd/cache.h b/fs/nfsd/cache.h
index b582f9ab6b2a..dd96a3830004 100644
--- a/fs/nfsd/cache.h
+++ b/fs/nfsd/cache.h
@@ -18,7 +18,6 @@
18 * is much larger than a sockaddr_in6. 18 * is much larger than a sockaddr_in6.
19 */ 19 */
20struct svc_cacherep { 20struct svc_cacherep {
21 struct hlist_node c_hash;
22 struct list_head c_lru; 21 struct list_head c_lru;
23 22
24 unsigned char c_state, /* unused, inprog, done */ 23 unsigned char c_state, /* unused, inprog, done */
diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c
index c01f44eb7fe4..8abec475f80f 100644
--- a/fs/nfsd/nfscache.c
+++ b/fs/nfsd/nfscache.c
@@ -28,7 +28,6 @@
28#define TARGET_BUCKET_SIZE 64 28#define TARGET_BUCKET_SIZE 64
29 29
30struct nfsd_drc_bucket { 30struct nfsd_drc_bucket {
31 struct hlist_head cache_hash;
32 struct list_head lru_head; 31 struct list_head lru_head;
33}; 32};
34 33
@@ -137,7 +136,6 @@ nfsd_reply_cache_alloc(void)
137 rp->c_state = RC_UNUSED; 136 rp->c_state = RC_UNUSED;
138 rp->c_type = RC_NOCACHE; 137 rp->c_type = RC_NOCACHE;
139 INIT_LIST_HEAD(&rp->c_lru); 138 INIT_LIST_HEAD(&rp->c_lru);
140 INIT_HLIST_NODE(&rp->c_hash);
141 } 139 }
142 return rp; 140 return rp;
143} 141}
@@ -149,8 +147,6 @@ nfsd_reply_cache_free_locked(struct svc_cacherep *rp)
149 drc_mem_usage -= rp->c_replvec.iov_len; 147 drc_mem_usage -= rp->c_replvec.iov_len;
150 kfree(rp->c_replvec.iov_base); 148 kfree(rp->c_replvec.iov_base);
151 } 149 }
152 if (!hlist_unhashed(&rp->c_hash))
153 hlist_del(&rp->c_hash);
154 list_del(&rp->c_lru); 150 list_del(&rp->c_lru);
155 --num_drc_entries; 151 --num_drc_entries;
156 drc_mem_usage -= sizeof(*rp); 152 drc_mem_usage -= sizeof(*rp);
@@ -233,16 +229,6 @@ lru_put_end(struct nfsd_drc_bucket *b, struct svc_cacherep *rp)
233 schedule_delayed_work(&cache_cleaner, RC_EXPIRE); 229 schedule_delayed_work(&cache_cleaner, RC_EXPIRE);
234} 230}
235 231
236/*
237 * Move a cache entry from one hash list to another
238 */
239static void
240hash_refile(struct nfsd_drc_bucket *b, struct svc_cacherep *rp)
241{
242 hlist_del_init(&rp->c_hash);
243 hlist_add_head(&rp->c_hash, &b->cache_hash);
244}
245
246static long 232static long
247prune_bucket(struct nfsd_drc_bucket *b) 233prune_bucket(struct nfsd_drc_bucket *b)
248{ 234{
@@ -386,10 +372,10 @@ nfsd_cache_search(struct nfsd_drc_bucket *b, struct svc_rqst *rqstp,
386 __wsum csum) 372 __wsum csum)
387{ 373{
388 struct svc_cacherep *rp, *ret = NULL; 374 struct svc_cacherep *rp, *ret = NULL;
389 struct hlist_head *rh = &b->cache_hash; 375 struct list_head *rh = &b->lru_head;
390 unsigned int entries = 0; 376 unsigned int entries = 0;
391 377
392 hlist_for_each_entry(rp, rh, c_hash) { 378 list_for_each_entry(rp, rh, c_lru) {
393 ++entries; 379 ++entries;
394 if (nfsd_cache_match(rqstp, csum, rp)) { 380 if (nfsd_cache_match(rqstp, csum, rp)) {
395 ret = rp; 381 ret = rp;
@@ -479,7 +465,6 @@ nfsd_cache_lookup(struct svc_rqst *rqstp)
479 rp->c_len = rqstp->rq_arg.len; 465 rp->c_len = rqstp->rq_arg.len;
480 rp->c_csum = csum; 466 rp->c_csum = csum;
481 467
482 hash_refile(b, rp);
483 lru_put_end(b, rp); 468 lru_put_end(b, rp);
484 469
485 /* release any buffer */ 470 /* release any buffer */