diff options
author | NeilBrown <neilb@cse.unsw.edu.au> | 2005-06-24 01:03:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-24 03:06:32 -0400 |
commit | ac4d8ff2a57179de3ef7834c6ab3fac430b0a05d (patch) | |
tree | 8c0f7125177a47d4140a73e4b59309a5bb3ffd2c /fs | |
parent | 76a3550ec50ed86885a10a767ebaebb7c9104721 (diff) |
[PATCH] knfsd: nfsd4: clean up state initialization
Separate out stuff that needs initialization on startup from stuff that only
needs initialization on module init from static data.
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')
-rw-r--r-- | fs/nfsd/nfs4state.c | 35 | ||||
-rw-r--r-- | fs/nfsd/nfsctl.c | 1 |
2 files changed, 18 insertions, 18 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index e00b3472851c..1f68ce36e724 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -117,7 +117,7 @@ static void release_stateid(struct nfs4_stateid *stp, int flags); | |||
117 | */ | 117 | */ |
118 | 118 | ||
119 | /* recall_lock protects the del_recall_lru */ | 119 | /* recall_lock protects the del_recall_lru */ |
120 | spinlock_t recall_lock; | 120 | spinlock_t recall_lock = SPIN_LOCK_UNLOCKED; |
121 | static struct list_head del_recall_lru; | 121 | static struct list_head del_recall_lru; |
122 | 122 | ||
123 | static void | 123 | static void |
@@ -3179,23 +3179,13 @@ nfs4_check_open_reclaim(clientid_t *clid) | |||
3179 | return nfs4_find_reclaim_client(clid) ? nfs_ok : nfserr_reclaim_bad; | 3179 | return nfs4_find_reclaim_client(clid) ? nfs_ok : nfserr_reclaim_bad; |
3180 | } | 3180 | } |
3181 | 3181 | ||
3182 | /* initialization to perform at module load time: */ | ||
3182 | 3183 | ||
3183 | /* | 3184 | void |
3184 | * Start and stop routines | 3185 | nfs4_state_init(void) |
3185 | */ | ||
3186 | |||
3187 | static void | ||
3188 | __nfs4_state_start(void) | ||
3189 | { | 3186 | { |
3190 | int i; | 3187 | int i; |
3191 | time_t grace_time; | ||
3192 | 3188 | ||
3193 | if (!nfs4_reclaim_init) { | ||
3194 | for (i = 0; i < CLIENT_HASH_SIZE; i++) | ||
3195 | INIT_LIST_HEAD(&reclaim_str_hashtbl[i]); | ||
3196 | reclaim_str_hashtbl_size = 0; | ||
3197 | nfs4_reclaim_init = 1; | ||
3198 | } | ||
3199 | for (i = 0; i < CLIENT_HASH_SIZE; i++) { | 3189 | for (i = 0; i < CLIENT_HASH_SIZE; i++) { |
3200 | INIT_LIST_HEAD(&conf_id_hashtbl[i]); | 3190 | INIT_LIST_HEAD(&conf_id_hashtbl[i]); |
3201 | INIT_LIST_HEAD(&conf_str_hashtbl[i]); | 3191 | INIT_LIST_HEAD(&conf_str_hashtbl[i]); |
@@ -3217,19 +3207,28 @@ __nfs4_state_start(void) | |||
3217 | INIT_LIST_HEAD(&lock_ownerid_hashtbl[i]); | 3207 | INIT_LIST_HEAD(&lock_ownerid_hashtbl[i]); |
3218 | INIT_LIST_HEAD(&lock_ownerstr_hashtbl[i]); | 3208 | INIT_LIST_HEAD(&lock_ownerstr_hashtbl[i]); |
3219 | } | 3209 | } |
3220 | memset(&zerostateid, 0, sizeof(stateid_t)); | ||
3221 | memset(&onestateid, ~0, sizeof(stateid_t)); | 3210 | memset(&onestateid, ~0, sizeof(stateid_t)); |
3222 | |||
3223 | INIT_LIST_HEAD(&close_lru); | 3211 | INIT_LIST_HEAD(&close_lru); |
3224 | INIT_LIST_HEAD(&client_lru); | 3212 | INIT_LIST_HEAD(&client_lru); |
3225 | INIT_LIST_HEAD(&del_recall_lru); | 3213 | INIT_LIST_HEAD(&del_recall_lru); |
3226 | spin_lock_init(&recall_lock); | 3214 | for (i = 0; i < CLIENT_HASH_SIZE; i++) |
3215 | INIT_LIST_HEAD(&reclaim_str_hashtbl[i]); | ||
3216 | reclaim_str_hashtbl_size = 0; | ||
3217 | nfs4_reclaim_init = 1; | ||
3218 | } | ||
3219 | |||
3220 | /* initialization to perform when the nfsd service is started: */ | ||
3221 | |||
3222 | static void | ||
3223 | __nfs4_state_start(void) | ||
3224 | { | ||
3225 | time_t grace_time; | ||
3226 | |||
3227 | boot_time = get_seconds(); | 3227 | boot_time = get_seconds(); |
3228 | grace_time = max(user_lease_time, lease_time); | 3228 | grace_time = max(user_lease_time, lease_time); |
3229 | lease_time = user_lease_time; | 3229 | lease_time = user_lease_time; |
3230 | printk("NFSD: starting %ld-second grace period\n", grace_time); | 3230 | printk("NFSD: starting %ld-second grace period\n", grace_time); |
3231 | grace_end = boot_time + grace_time; | 3231 | grace_end = boot_time + grace_time; |
3232 | INIT_WORK(&laundromat_work,laundromat_main, NULL); | ||
3233 | laundry_wq = create_singlethread_workqueue("nfsd4"); | 3232 | laundry_wq = create_singlethread_workqueue("nfsd4"); |
3234 | queue_delayed_work(laundry_wq, &laundromat_work, NFSD_LEASE_TIME*HZ); | 3233 | queue_delayed_work(laundry_wq, &laundromat_work, NFSD_LEASE_TIME*HZ); |
3235 | } | 3234 | } |
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 161afdcb8f7d..3d56531a7a03 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
@@ -397,6 +397,7 @@ static int __init init_nfsd(void) | |||
397 | nfsd_cache_init(); /* RPC reply cache */ | 397 | nfsd_cache_init(); /* RPC reply cache */ |
398 | nfsd_export_init(); /* Exports table */ | 398 | nfsd_export_init(); /* Exports table */ |
399 | nfsd_lockd_init(); /* lockd->nfsd callbacks */ | 399 | nfsd_lockd_init(); /* lockd->nfsd callbacks */ |
400 | nfs4_state_init(); /* NFSv4 locking state */ | ||
400 | #ifdef CONFIG_NFSD_V4 | 401 | #ifdef CONFIG_NFSD_V4 |
401 | nfsd_idmap_init(); /* Name to ID mapping */ | 402 | nfsd_idmap_init(); /* Name to ID mapping */ |
402 | #endif /* CONFIG_NFSD_V4 */ | 403 | #endif /* CONFIG_NFSD_V4 */ |