diff options
author | Christoph Hellwig <hch@infradead.org> | 2014-05-21 10:43:03 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2014-05-22 15:52:57 -0400 |
commit | abf1135b6ee31cc17f569f2a59f87c833ba0849c (patch) | |
tree | 91471c9af5399aaa0c477c9984261254f1c3c838 | |
parent | d40aa3372f90d478b6166df0321349b5aeb0aea8 (diff) |
nfsd: remove nfsd4_free_slab
No need for a kmem_cache_destroy wrapper in nfsd, just do proper
goto based unwinding.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r-- | fs/nfsd/nfs4state.c | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index a037627ce5c7..42f6c25ec8e8 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -83,11 +83,11 @@ static DEFINE_MUTEX(client_mutex); | |||
83 | */ | 83 | */ |
84 | static DEFINE_SPINLOCK(recall_lock); | 84 | static DEFINE_SPINLOCK(recall_lock); |
85 | 85 | ||
86 | static struct kmem_cache *openowner_slab = NULL; | 86 | static struct kmem_cache *openowner_slab; |
87 | static struct kmem_cache *lockowner_slab = NULL; | 87 | static struct kmem_cache *lockowner_slab; |
88 | static struct kmem_cache *file_slab = NULL; | 88 | static struct kmem_cache *file_slab; |
89 | static struct kmem_cache *stateid_slab = NULL; | 89 | static struct kmem_cache *stateid_slab; |
90 | static struct kmem_cache *deleg_slab = NULL; | 90 | static struct kmem_cache *deleg_slab; |
91 | 91 | ||
92 | void | 92 | void |
93 | nfs4_lock_state(void) | 93 | nfs4_lock_state(void) |
@@ -2520,23 +2520,14 @@ static void nfsd4_init_file(struct nfs4_file *fp, struct inode *ino) | |||
2520 | spin_unlock(&recall_lock); | 2520 | spin_unlock(&recall_lock); |
2521 | } | 2521 | } |
2522 | 2522 | ||
2523 | static void | ||
2524 | nfsd4_free_slab(struct kmem_cache **slab) | ||
2525 | { | ||
2526 | if (*slab == NULL) | ||
2527 | return; | ||
2528 | kmem_cache_destroy(*slab); | ||
2529 | *slab = NULL; | ||
2530 | } | ||
2531 | |||
2532 | void | 2523 | void |
2533 | nfsd4_free_slabs(void) | 2524 | nfsd4_free_slabs(void) |
2534 | { | 2525 | { |
2535 | nfsd4_free_slab(&openowner_slab); | 2526 | kmem_cache_destroy(openowner_slab); |
2536 | nfsd4_free_slab(&lockowner_slab); | 2527 | kmem_cache_destroy(lockowner_slab); |
2537 | nfsd4_free_slab(&file_slab); | 2528 | kmem_cache_destroy(file_slab); |
2538 | nfsd4_free_slab(&stateid_slab); | 2529 | kmem_cache_destroy(stateid_slab); |
2539 | nfsd4_free_slab(&deleg_slab); | 2530 | kmem_cache_destroy(deleg_slab); |
2540 | } | 2531 | } |
2541 | 2532 | ||
2542 | int | 2533 | int |
@@ -2545,26 +2536,34 @@ nfsd4_init_slabs(void) | |||
2545 | openowner_slab = kmem_cache_create("nfsd4_openowners", | 2536 | openowner_slab = kmem_cache_create("nfsd4_openowners", |
2546 | sizeof(struct nfs4_openowner), 0, 0, NULL); | 2537 | sizeof(struct nfs4_openowner), 0, 0, NULL); |
2547 | if (openowner_slab == NULL) | 2538 | if (openowner_slab == NULL) |
2548 | goto out_nomem; | 2539 | goto out; |
2549 | lockowner_slab = kmem_cache_create("nfsd4_lockowners", | 2540 | lockowner_slab = kmem_cache_create("nfsd4_lockowners", |
2550 | sizeof(struct nfs4_lockowner), 0, 0, NULL); | 2541 | sizeof(struct nfs4_lockowner), 0, 0, NULL); |
2551 | if (lockowner_slab == NULL) | 2542 | if (lockowner_slab == NULL) |
2552 | goto out_nomem; | 2543 | goto out_free_openowner_slab; |
2553 | file_slab = kmem_cache_create("nfsd4_files", | 2544 | file_slab = kmem_cache_create("nfsd4_files", |
2554 | sizeof(struct nfs4_file), 0, 0, NULL); | 2545 | sizeof(struct nfs4_file), 0, 0, NULL); |
2555 | if (file_slab == NULL) | 2546 | if (file_slab == NULL) |
2556 | goto out_nomem; | 2547 | goto out_free_lockowner_slab; |
2557 | stateid_slab = kmem_cache_create("nfsd4_stateids", | 2548 | stateid_slab = kmem_cache_create("nfsd4_stateids", |
2558 | sizeof(struct nfs4_ol_stateid), 0, 0, NULL); | 2549 | sizeof(struct nfs4_ol_stateid), 0, 0, NULL); |
2559 | if (stateid_slab == NULL) | 2550 | if (stateid_slab == NULL) |
2560 | goto out_nomem; | 2551 | goto out_free_file_slab; |
2561 | deleg_slab = kmem_cache_create("nfsd4_delegations", | 2552 | deleg_slab = kmem_cache_create("nfsd4_delegations", |
2562 | sizeof(struct nfs4_delegation), 0, 0, NULL); | 2553 | sizeof(struct nfs4_delegation), 0, 0, NULL); |
2563 | if (deleg_slab == NULL) | 2554 | if (deleg_slab == NULL) |
2564 | goto out_nomem; | 2555 | goto out_free_stateid_slab; |
2565 | return 0; | 2556 | return 0; |
2566 | out_nomem: | 2557 | |
2567 | nfsd4_free_slabs(); | 2558 | out_free_stateid_slab: |
2559 | kmem_cache_destroy(stateid_slab); | ||
2560 | out_free_file_slab: | ||
2561 | kmem_cache_destroy(file_slab); | ||
2562 | out_free_lockowner_slab: | ||
2563 | kmem_cache_destroy(lockowner_slab); | ||
2564 | out_free_openowner_slab: | ||
2565 | kmem_cache_destroy(openowner_slab); | ||
2566 | out: | ||
2568 | dprintk("nfsd4: out of memory while initializing nfsv4\n"); | 2567 | dprintk("nfsd4: out of memory while initializing nfsv4\n"); |
2569 | return -ENOMEM; | 2568 | return -ENOMEM; |
2570 | } | 2569 | } |