diff options
author | Jeff Layton <jlayton@redhat.com> | 2013-02-04 08:18:01 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2013-02-04 17:19:09 -0500 |
commit | 0ee0bf7ee5b55f232b645c4af0b0c37d4e115a32 (patch) | |
tree | 1d27db3b3f93d4fc257d70a960d33129d9cf6d93 /fs/nfsd/nfscache.c | |
parent | 56c2548b2d24de440868885e4c36c985eca2d083 (diff) |
nfsd: track the number of DRC entries in the cache
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfscache.c')
-rw-r--r-- | fs/nfsd/nfscache.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c index 9d80dfa7778e..c0c58471eb45 100644 --- a/fs/nfsd/nfscache.c +++ b/fs/nfsd/nfscache.c | |||
@@ -27,6 +27,7 @@ static struct hlist_head * cache_hash; | |||
27 | static struct list_head lru_head; | 27 | static struct list_head lru_head; |
28 | static int cache_disabled = 1; | 28 | static int cache_disabled = 1; |
29 | static struct kmem_cache *drc_slab; | 29 | static struct kmem_cache *drc_slab; |
30 | static unsigned int num_drc_entries; | ||
30 | 31 | ||
31 | /* | 32 | /* |
32 | * Calculate the hash index from an XID. | 33 | * Calculate the hash index from an XID. |
@@ -68,6 +69,7 @@ nfsd_reply_cache_free_locked(struct svc_cacherep *rp) | |||
68 | if (rp->c_type == RC_REPLBUFF) | 69 | if (rp->c_type == RC_REPLBUFF) |
69 | kfree(rp->c_replvec.iov_base); | 70 | kfree(rp->c_replvec.iov_base); |
70 | list_del(&rp->c_lru); | 71 | list_del(&rp->c_lru); |
72 | --num_drc_entries; | ||
71 | kmem_cache_free(drc_slab, rp); | 73 | kmem_cache_free(drc_slab, rp); |
72 | } | 74 | } |
73 | 75 | ||
@@ -83,10 +85,12 @@ int nfsd_reply_cache_init(void) | |||
83 | 85 | ||
84 | INIT_LIST_HEAD(&lru_head); | 86 | INIT_LIST_HEAD(&lru_head); |
85 | i = CACHESIZE; | 87 | i = CACHESIZE; |
88 | num_drc_entries = 0; | ||
86 | while (i) { | 89 | while (i) { |
87 | rp = nfsd_reply_cache_alloc(); | 90 | rp = nfsd_reply_cache_alloc(); |
88 | if (!rp) | 91 | if (!rp) |
89 | goto out_nomem; | 92 | goto out_nomem; |
93 | ++num_drc_entries; | ||
90 | list_add(&rp->c_lru, &lru_head); | 94 | list_add(&rp->c_lru, &lru_head); |
91 | i--; | 95 | i--; |
92 | } | 96 | } |