diff options
author | J. Bruce Fields <bfields@citi.umich.edu> | 2007-08-01 15:30:59 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2007-10-09 18:31:56 -0400 |
commit | e8ff2a8453cedf38d6d7a0528cb9c308066a3e3e (patch) | |
tree | 6987fee75558983f92cbba7385e39acc44f7555e /fs/nfsd/nfs4state.c | |
parent | 2b47eece1fa519a81c8b802af77a8b8aa44baa10 (diff) |
knfsd: move nfsv4 slab creation/destruction to module init/exit
We have some slabs that the nfs4 server uses to store state objects.
We're currently creating and destroying those slabs whenever the server
is brought up or down. That seems excessive; may as well just do that
in module initialization and exit.
Also add some minor header cleanup. (Thanks to Andrew Morton for that
and a compile fix.)
Signed-off-by: "J. Bruce Fields" <bfields@citi.umich.edu>
Acked-by: Neil Brown <neilb@suse.de>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r-- | fs/nfsd/nfs4state.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 2b20eb8589a0..09573b9f76c7 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -1021,7 +1021,7 @@ nfsd4_free_slab(struct kmem_cache **slab) | |||
1021 | *slab = NULL; | 1021 | *slab = NULL; |
1022 | } | 1022 | } |
1023 | 1023 | ||
1024 | static void | 1024 | void |
1025 | nfsd4_free_slabs(void) | 1025 | nfsd4_free_slabs(void) |
1026 | { | 1026 | { |
1027 | nfsd4_free_slab(&stateowner_slab); | 1027 | nfsd4_free_slab(&stateowner_slab); |
@@ -3152,11 +3152,14 @@ nfs4_check_open_reclaim(clientid_t *clid) | |||
3152 | 3152 | ||
3153 | /* initialization to perform at module load time: */ | 3153 | /* initialization to perform at module load time: */ |
3154 | 3154 | ||
3155 | void | 3155 | int |
3156 | nfs4_state_init(void) | 3156 | nfs4_state_init(void) |
3157 | { | 3157 | { |
3158 | int i; | 3158 | int i, status; |
3159 | 3159 | ||
3160 | status = nfsd4_init_slabs(); | ||
3161 | if (status) | ||
3162 | return status; | ||
3160 | for (i = 0; i < CLIENT_HASH_SIZE; i++) { | 3163 | for (i = 0; i < CLIENT_HASH_SIZE; i++) { |
3161 | INIT_LIST_HEAD(&conf_id_hashtbl[i]); | 3164 | INIT_LIST_HEAD(&conf_id_hashtbl[i]); |
3162 | INIT_LIST_HEAD(&conf_str_hashtbl[i]); | 3165 | INIT_LIST_HEAD(&conf_str_hashtbl[i]); |
@@ -3185,6 +3188,7 @@ nfs4_state_init(void) | |||
3185 | for (i = 0; i < CLIENT_HASH_SIZE; i++) | 3188 | for (i = 0; i < CLIENT_HASH_SIZE; i++) |
3186 | INIT_LIST_HEAD(&reclaim_str_hashtbl[i]); | 3189 | INIT_LIST_HEAD(&reclaim_str_hashtbl[i]); |
3187 | reclaim_str_hashtbl_size = 0; | 3190 | reclaim_str_hashtbl_size = 0; |
3191 | return 0; | ||
3188 | } | 3192 | } |
3189 | 3193 | ||
3190 | static void | 3194 | static void |
@@ -3245,20 +3249,15 @@ __nfs4_state_start(void) | |||
3245 | set_max_delegations(); | 3249 | set_max_delegations(); |
3246 | } | 3250 | } |
3247 | 3251 | ||
3248 | int | 3252 | void |
3249 | nfs4_state_start(void) | 3253 | nfs4_state_start(void) |
3250 | { | 3254 | { |
3251 | int status; | ||
3252 | |||
3253 | if (nfs4_init) | 3255 | if (nfs4_init) |
3254 | return 0; | 3256 | return; |
3255 | status = nfsd4_init_slabs(); | ||
3256 | if (status) | ||
3257 | return status; | ||
3258 | nfsd4_load_reboot_recovery_data(); | 3257 | nfsd4_load_reboot_recovery_data(); |
3259 | __nfs4_state_start(); | 3258 | __nfs4_state_start(); |
3260 | nfs4_init = 1; | 3259 | nfs4_init = 1; |
3261 | return 0; | 3260 | return; |
3262 | } | 3261 | } |
3263 | 3262 | ||
3264 | int | 3263 | int |
@@ -3316,7 +3315,6 @@ nfs4_state_shutdown(void) | |||
3316 | nfs4_lock_state(); | 3315 | nfs4_lock_state(); |
3317 | nfs4_release_reclaim(); | 3316 | nfs4_release_reclaim(); |
3318 | __nfs4_state_shutdown(); | 3317 | __nfs4_state_shutdown(); |
3319 | nfsd4_free_slabs(); | ||
3320 | nfs4_unlock_state(); | 3318 | nfs4_unlock_state(); |
3321 | } | 3319 | } |
3322 | 3320 | ||