From 992926f5145c2950b2833fb7576b631794225e75 Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Mon, 28 Jan 2013 14:41:10 -0500 Subject: [PATCH] --- yaml --- r: 359712 b: refs/heads/master c: 8a8bc40d9ba0890f88dbf7a7c8fa81ddc77c08e3 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/nfsd/nfscache.c | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 285db9cad13a..6fcd70e750fa 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 09662d58d5a2d75c8c29558dda4fc5134ef14b25 +refs/heads/master: 8a8bc40d9ba0890f88dbf7a7c8fa81ddc77c08e3 diff --git a/trunk/fs/nfsd/nfscache.c b/trunk/fs/nfsd/nfscache.c index 972c14a033ee..4aad9e4a6161 100644 --- a/trunk/fs/nfsd/nfscache.c +++ b/trunk/fs/nfsd/nfscache.c @@ -26,6 +26,7 @@ static struct hlist_head * cache_hash; static struct list_head lru_head; static int cache_disabled = 1; +static struct kmem_cache *drc_slab; /* * Calculate the hash index from an XID. @@ -51,10 +52,15 @@ int nfsd_reply_cache_init(void) struct svc_cacherep *rp; int i; + drc_slab = kmem_cache_create("nfsd_drc", sizeof(struct svc_cacherep), + 0, 0, NULL); + if (!drc_slab) + goto out_nomem; + INIT_LIST_HEAD(&lru_head); i = CACHESIZE; while (i) { - rp = kmalloc(sizeof(*rp), GFP_KERNEL); + rp = kmem_cache_alloc(drc_slab, GFP_KERNEL); if (!rp) goto out_nomem; list_add(&rp->c_lru, &lru_head); @@ -85,13 +91,18 @@ void nfsd_reply_cache_shutdown(void) if (rp->c_state == RC_DONE && rp->c_type == RC_REPLBUFF) kfree(rp->c_replvec.iov_base); list_del(&rp->c_lru); - kfree(rp); + kmem_cache_free(drc_slab, rp); } cache_disabled = 1; kfree (cache_hash); cache_hash = NULL; + + if (drc_slab) { + kmem_cache_destroy(drc_slab); + drc_slab = NULL; + } } /*