diff options
author | Greg Banks <gnb@melbourne.sgi.com> | 2006-10-02 05:18:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-02 10:57:20 -0400 |
commit | eec09661dc82e90a31051d045a94026a91aceb82 (patch) | |
tree | 2d487c532ce0fc0535709b599a034838e142ce75 /fs | |
parent | a74554429eada89a7ddb47317e6a2968d03e41a2 (diff) |
[PATCH] knfsd: use svc_set_num_threads to manage threads in knfsd
Replace the existing list of all nfsd threads with new code using
svc_create_pooled().
Signed-off-by: Greg Banks <gnb@melbourne.sgi.com>
Signed-off-by: Neil Brown <neilb@suse.de>
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/nfssvc.c | 36 |
1 files changed, 5 insertions, 31 deletions
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index 9773f593b3ff..0029cb290f18 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c | |||
@@ -57,12 +57,6 @@ static atomic_t nfsd_busy; | |||
57 | static unsigned long nfsd_last_call; | 57 | static unsigned long nfsd_last_call; |
58 | static DEFINE_SPINLOCK(nfsd_call_lock); | 58 | static DEFINE_SPINLOCK(nfsd_call_lock); |
59 | 59 | ||
60 | struct nfsd_list { | ||
61 | struct list_head list; | ||
62 | struct task_struct *task; | ||
63 | }; | ||
64 | static struct list_head nfsd_list = LIST_HEAD_INIT(nfsd_list); | ||
65 | |||
66 | #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) | 60 | #if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL) |
67 | static struct svc_stat nfsd_acl_svcstats; | 61 | static struct svc_stat nfsd_acl_svcstats; |
68 | static struct svc_version * nfsd_acl_version[] = { | 62 | static struct svc_version * nfsd_acl_version[] = { |
@@ -206,8 +200,9 @@ int nfsd_create_serv(void) | |||
206 | } | 200 | } |
207 | 201 | ||
208 | atomic_set(&nfsd_busy, 0); | 202 | atomic_set(&nfsd_busy, 0); |
209 | nfsd_serv = svc_create(&nfsd_program, NFSD_BUFSIZE, | 203 | nfsd_serv = svc_create_pooled(&nfsd_program, NFSD_BUFSIZE, |
210 | nfsd_last_thread); | 204 | nfsd_last_thread, |
205 | nfsd, SIG_NOCLEAN, THIS_MODULE); | ||
211 | if (nfsd_serv == NULL) | 206 | if (nfsd_serv == NULL) |
212 | err = -ENOMEM; | 207 | err = -ENOMEM; |
213 | unlock_kernel(); | 208 | unlock_kernel(); |
@@ -247,7 +242,6 @@ int | |||
247 | nfsd_svc(unsigned short port, int nrservs) | 242 | nfsd_svc(unsigned short port, int nrservs) |
248 | { | 243 | { |
249 | int error; | 244 | int error; |
250 | struct list_head *victim; | ||
251 | 245 | ||
252 | lock_kernel(); | 246 | lock_kernel(); |
253 | dprintk("nfsd: creating service\n"); | 247 | dprintk("nfsd: creating service\n"); |
@@ -275,24 +269,7 @@ nfsd_svc(unsigned short port, int nrservs) | |||
275 | if (error) | 269 | if (error) |
276 | goto failure; | 270 | goto failure; |
277 | 271 | ||
278 | nrservs -= (nfsd_serv->sv_nrthreads-1); | 272 | error = svc_set_num_threads(nfsd_serv, NULL, nrservs); |
279 | while (nrservs > 0) { | ||
280 | nrservs--; | ||
281 | __module_get(THIS_MODULE); | ||
282 | error = svc_create_thread(nfsd, nfsd_serv); | ||
283 | if (error < 0) { | ||
284 | module_put(THIS_MODULE); | ||
285 | break; | ||
286 | } | ||
287 | } | ||
288 | victim = nfsd_list.next; | ||
289 | while (nrservs < 0 && victim != &nfsd_list) { | ||
290 | struct nfsd_list *nl = | ||
291 | list_entry(victim,struct nfsd_list, list); | ||
292 | victim = victim->next; | ||
293 | send_sig(SIG_NOCLEAN, nl->task, 1); | ||
294 | nrservs++; | ||
295 | } | ||
296 | failure: | 273 | failure: |
297 | svc_destroy(nfsd_serv); /* Release server */ | 274 | svc_destroy(nfsd_serv); /* Release server */ |
298 | out: | 275 | out: |
@@ -329,7 +306,6 @@ nfsd(struct svc_rqst *rqstp) | |||
329 | { | 306 | { |
330 | struct fs_struct *fsp; | 307 | struct fs_struct *fsp; |
331 | int err; | 308 | int err; |
332 | struct nfsd_list me; | ||
333 | sigset_t shutdown_mask, allowed_mask; | 309 | sigset_t shutdown_mask, allowed_mask; |
334 | 310 | ||
335 | /* Lock module and set up kernel thread */ | 311 | /* Lock module and set up kernel thread */ |
@@ -353,8 +329,7 @@ nfsd(struct svc_rqst *rqstp) | |||
353 | 329 | ||
354 | nfsdstats.th_cnt++; | 330 | nfsdstats.th_cnt++; |
355 | 331 | ||
356 | me.task = current; | 332 | rqstp->rq_task = current; |
357 | list_add(&me.list, &nfsd_list); | ||
358 | 333 | ||
359 | unlock_kernel(); | 334 | unlock_kernel(); |
360 | 335 | ||
@@ -413,7 +388,6 @@ nfsd(struct svc_rqst *rqstp) | |||
413 | 388 | ||
414 | lock_kernel(); | 389 | lock_kernel(); |
415 | 390 | ||
416 | list_del(&me.list); | ||
417 | nfsdstats.th_cnt --; | 391 | nfsdstats.th_cnt --; |
418 | 392 | ||
419 | out: | 393 | out: |