summaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorNeilBrown <neilb@cse.unsw.edu.au>2005-06-23 22:03:04 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-24 00:06:29 -0700
commit5b2d21c1965859acc881dd862b6ebbfae67cdc14 (patch)
tree4d7879cd09f0d0efd5e19e9a008668879327efe9 /fs/nfsd
parent5ac049ac66416bbe84923f7c2384f23f6ee4aa88 (diff)
[PATCH] nfsd4: slabify delegations
Allocate delegations from a slab cache. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfs4state.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index c5fce309d87..927d2007d5a 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -72,8 +72,6 @@ u32 add_perclient = 0;
u32 del_perclient = 0;
u32 vfsopen = 0;
u32 vfsclose = 0;
-u32 alloc_delegation= 0;
-u32 free_delegation= 0;
/* forward declarations */
struct nfs4_stateid * find_stateid(stateid_t *stid, int flags);
@@ -91,6 +89,7 @@ static DECLARE_MUTEX(client_sema);
kmem_cache_t *stateowner_slab = NULL;
kmem_cache_t *file_slab = NULL;
kmem_cache_t *stateid_slab = NULL;
+kmem_cache_t *deleg_slab = NULL;
void
nfs4_lock_state(void)
@@ -138,8 +137,8 @@ alloc_init_deleg(struct nfs4_client *clp, struct nfs4_stateid *stp, struct svc_f
struct nfs4_callback *cb = &stp->st_stateowner->so_client->cl_callback;
dprintk("NFSD alloc_init_deleg\n");
- if ((dp = kmalloc(sizeof(struct nfs4_delegation),
- GFP_KERNEL)) == NULL)
+ dp = kmem_cache_alloc(deleg_slab, GFP_KERNEL);
+ if (dp == NULL)
return dp;
INIT_LIST_HEAD(&dp->dl_del_perfile);
INIT_LIST_HEAD(&dp->dl_del_perclnt);
@@ -164,7 +163,6 @@ alloc_init_deleg(struct nfs4_client *clp, struct nfs4_stateid *stp, struct svc_f
atomic_set(&dp->dl_count, 1);
list_add(&dp->dl_del_perfile, &fp->fi_del_perfile);
list_add(&dp->dl_del_perclnt, &clp->cl_del_perclnt);
- alloc_delegation++;
return dp;
}
@@ -173,8 +171,7 @@ nfs4_put_delegation(struct nfs4_delegation *dp)
{
if (atomic_dec_and_test(&dp->dl_count)) {
dprintk("NFSD: freeing dp %p\n",dp);
- kfree(dp);
- free_delegation++;
+ kmem_cache_free(deleg_slab, dp);
}
}
@@ -1012,6 +1009,7 @@ nfsd4_free_slabs(void)
nfsd4_free_slab(&stateowner_slab);
nfsd4_free_slab(&file_slab);
nfsd4_free_slab(&stateid_slab);
+ nfsd4_free_slab(&deleg_slab);
}
static int
@@ -1029,6 +1027,10 @@ nfsd4_init_slabs(void)
sizeof(struct nfs4_stateid), 0, 0, NULL, NULL);
if (stateid_slab == NULL)
goto out_nomem;
+ deleg_slab = kmem_cache_create("nfsd4_delegations",
+ sizeof(struct nfs4_delegation), 0, 0, NULL, NULL);
+ if (deleg_slab == NULL)
+ goto out_nomem;
return 0;
out_nomem:
nfsd4_free_slabs();
@@ -3312,9 +3314,6 @@ __nfs4_state_shutdown(void)
add_perclient, del_perclient);
dprintk("NFSD: vfsopen %d vfsclose %d\n",
vfsopen, vfsclose);
- dprintk("NFSD: alloc_delegation %d free_delegation %d\n",
- alloc_delegation, free_delegation);
-
}
void