mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-05 08:26:59 +00:00
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>
This commit is contained in:
parent
56c2548b2d
commit
0ee0bf7ee5
1 changed files with 4 additions and 0 deletions
|
@ -27,6 +27,7 @@ static struct hlist_head * cache_hash;
|
||||||
static struct list_head lru_head;
|
static struct list_head lru_head;
|
||||||
static int cache_disabled = 1;
|
static int cache_disabled = 1;
|
||||||
static struct kmem_cache *drc_slab;
|
static struct kmem_cache *drc_slab;
|
||||||
|
static unsigned int num_drc_entries;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Calculate the hash index from an XID.
|
* Calculate the hash index from an XID.
|
||||||
|
@ -68,6 +69,7 @@ nfsd_reply_cache_free_locked(struct svc_cacherep *rp)
|
||||||
if (rp->c_type == RC_REPLBUFF)
|
if (rp->c_type == RC_REPLBUFF)
|
||||||
kfree(rp->c_replvec.iov_base);
|
kfree(rp->c_replvec.iov_base);
|
||||||
list_del(&rp->c_lru);
|
list_del(&rp->c_lru);
|
||||||
|
--num_drc_entries;
|
||||||
kmem_cache_free(drc_slab, rp);
|
kmem_cache_free(drc_slab, rp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,10 +85,12 @@ int nfsd_reply_cache_init(void)
|
||||||
|
|
||||||
INIT_LIST_HEAD(&lru_head);
|
INIT_LIST_HEAD(&lru_head);
|
||||||
i = CACHESIZE;
|
i = CACHESIZE;
|
||||||
|
num_drc_entries = 0;
|
||||||
while (i) {
|
while (i) {
|
||||||
rp = nfsd_reply_cache_alloc();
|
rp = nfsd_reply_cache_alloc();
|
||||||
if (!rp)
|
if (!rp)
|
||||||
goto out_nomem;
|
goto out_nomem;
|
||||||
|
++num_drc_entries;
|
||||||
list_add(&rp->c_lru, &lru_head);
|
list_add(&rp->c_lru, &lru_head);
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue