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 | |
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')
-rw-r--r-- | fs/nfsd/nfs4state.c | 22 | ||||
-rw-r--r-- | fs/nfsd/nfsctl.c | 5 | ||||
-rw-r--r-- | fs/nfsd/nfssvc.c | 4 |
3 files changed, 15 insertions, 16 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 | ||
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index baac89d917ca..d135f5f98519 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
@@ -679,11 +679,13 @@ static int __init init_nfsd(void) | |||
679 | int retval; | 679 | int retval; |
680 | printk(KERN_INFO "Installing knfsd (copyright (C) 1996 okir@monad.swb.de).\n"); | 680 | printk(KERN_INFO "Installing knfsd (copyright (C) 1996 okir@monad.swb.de).\n"); |
681 | 681 | ||
682 | retval = nfs4_state_init(); /* nfs4 locking state */ | ||
683 | if (retval) | ||
684 | return retval; | ||
682 | nfsd_stat_init(); /* Statistics */ | 685 | nfsd_stat_init(); /* Statistics */ |
683 | nfsd_cache_init(); /* RPC reply cache */ | 686 | nfsd_cache_init(); /* RPC reply cache */ |
684 | nfsd_export_init(); /* Exports table */ | 687 | nfsd_export_init(); /* Exports table */ |
685 | nfsd_lockd_init(); /* lockd->nfsd callbacks */ | 688 | nfsd_lockd_init(); /* lockd->nfsd callbacks */ |
686 | nfs4_state_init(); /* NFSv4 locking state */ | ||
687 | nfsd_idmap_init(); /* Name to ID mapping */ | 689 | nfsd_idmap_init(); /* Name to ID mapping */ |
688 | if (proc_mkdir("fs/nfs", NULL)) { | 690 | if (proc_mkdir("fs/nfs", NULL)) { |
689 | struct proc_dir_entry *entry; | 691 | struct proc_dir_entry *entry; |
@@ -712,6 +714,7 @@ static void __exit exit_nfsd(void) | |||
712 | nfsd_stat_shutdown(); | 714 | nfsd_stat_shutdown(); |
713 | nfsd_lockd_shutdown(); | 715 | nfsd_lockd_shutdown(); |
714 | nfsd_idmap_shutdown(); | 716 | nfsd_idmap_shutdown(); |
717 | nfsd4_free_slabs(); | ||
715 | unregister_filesystem(&nfsd_fs_type); | 718 | unregister_filesystem(&nfsd_fs_type); |
716 | } | 719 | } |
717 | 720 | ||
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index ef46f3228330..1190aeaa92be 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c | |||
@@ -349,9 +349,7 @@ nfsd_svc(unsigned short port, int nrservs) | |||
349 | error = nfsd_racache_init(2*nrservs); | 349 | error = nfsd_racache_init(2*nrservs); |
350 | if (error<0) | 350 | if (error<0) |
351 | goto out; | 351 | goto out; |
352 | error = nfs4_state_start(); | 352 | nfs4_state_start(); |
353 | if (error<0) | ||
354 | goto out; | ||
355 | 353 | ||
356 | nfsd_reset_versions(); | 354 | nfsd_reset_versions(); |
357 | 355 | ||