Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 359712
b: refs/heads/master
c: 8a8bc40
h: refs/heads/master
v: v3
  • Loading branch information
Jeff Layton authored and J. Bruce Fields committed Feb 4, 2013
1 parent c66a324 commit 992926f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 09662d58d5a2d75c8c29558dda4fc5134ef14b25
refs/heads/master: 8a8bc40d9ba0890f88dbf7a7c8fa81ddc77c08e3
15 changes: 13 additions & 2 deletions trunk/fs/nfsd/nfscache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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);
Expand Down Expand Up @@ -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;
}
}

/*
Expand Down

0 comments on commit 992926f

Please sign in to comment.