aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/sunrpc/svc.h
diff options
context:
space:
mode:
authorGreg Banks <gnb@melbourne.sgi.com>2006-10-02 05:17:59 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-02 10:57:19 -0400
commita74554429eada89a7ddb47317e6a2968d03e41a2 (patch)
tree0ebf1550dd1fdafd2900af44ea85d75831172fa3 /include/linux/sunrpc/svc.h
parent9a24ab5749a31aa10ee60d9310ad72f24d7c38ab (diff)
[PATCH] knfsd: add svc_set_num_threads
Currently knfsd keeps its own list of all nfsd threads in nfssvc.c; add a new way of managing the list of all threads in a svc_serv. Add svc_create_pooled() to allow creation of a svc_serv whose threads are managed by the sunrpc code. Add svc_set_num_threads() to manage the number of threads in a service, either per-pool or globally across the service. 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 'include/linux/sunrpc/svc.h')
-rw-r--r--include/linux/sunrpc/svc.h21
1 files changed, 16 insertions, 5 deletions
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 54d8e7bc2341..f2eeb833e7d8 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -17,6 +17,10 @@
17#include <linux/wait.h> 17#include <linux/wait.h>
18#include <linux/mm.h> 18#include <linux/mm.h>
19 19
20/*
21 * This is the RPC server thread function prototype
22 */
23typedef void (*svc_thread_fn)(struct svc_rqst *);
20 24
21/* 25/*
22 * 26 *
@@ -34,6 +38,7 @@ struct svc_pool {
34 struct list_head sp_threads; /* idle server threads */ 38 struct list_head sp_threads; /* idle server threads */
35 struct list_head sp_sockets; /* pending sockets */ 39 struct list_head sp_sockets; /* pending sockets */
36 unsigned int sp_nrthreads; /* # of threads in pool */ 40 unsigned int sp_nrthreads; /* # of threads in pool */
41 struct list_head sp_all_threads; /* all server threads */
37} ____cacheline_aligned_in_smp; 42} ____cacheline_aligned_in_smp;
38 43
39/* 44/*
@@ -68,6 +73,11 @@ struct svc_serv {
68 /* Callback to use when last thread 73 /* Callback to use when last thread
69 * exits. 74 * exits.
70 */ 75 */
76
77 struct module * sv_module; /* optional module to count when
78 * adding threads */
79 svc_thread_fn sv_function; /* main function for threads */
80 int sv_kill_signal; /* signal to kill threads */
71}; 81};
72 82
73/* 83/*
@@ -164,6 +174,7 @@ static inline void svc_putu32(struct kvec *iov, __be32 val)
164 */ 174 */
165struct svc_rqst { 175struct svc_rqst {
166 struct list_head rq_list; /* idle list */ 176 struct list_head rq_list; /* idle list */
177 struct list_head rq_all; /* all threads list */
167 struct svc_sock * rq_sock; /* socket */ 178 struct svc_sock * rq_sock; /* socket */
168 struct sockaddr_in rq_addr; /* peer address */ 179 struct sockaddr_in rq_addr; /* peer address */
169 int rq_addrlen; 180 int rq_addrlen;
@@ -218,6 +229,7 @@ struct svc_rqst {
218 * to prevent encrypting page 229 * to prevent encrypting page
219 * cache pages */ 230 * cache pages */
220 wait_queue_head_t rq_wait; /* synchronization */ 231 wait_queue_head_t rq_wait; /* synchronization */
232 struct task_struct *rq_task; /* service thread */
221}; 233};
222 234
223/* 235/*
@@ -359,17 +371,16 @@ struct svc_procedure {
359}; 371};
360 372
361/* 373/*
362 * This is the RPC server thread function prototype
363 */
364typedef void (*svc_thread_fn)(struct svc_rqst *);
365
366/*
367 * Function prototypes. 374 * Function prototypes.
368 */ 375 */
369struct svc_serv * svc_create(struct svc_program *, unsigned int, 376struct svc_serv * svc_create(struct svc_program *, unsigned int,
370 void (*shutdown)(struct svc_serv*)); 377 void (*shutdown)(struct svc_serv*));
371int svc_create_thread(svc_thread_fn, struct svc_serv *); 378int svc_create_thread(svc_thread_fn, struct svc_serv *);
372void svc_exit_thread(struct svc_rqst *); 379void svc_exit_thread(struct svc_rqst *);
380struct svc_serv * svc_create_pooled(struct svc_program *, unsigned int,
381 void (*shutdown)(struct svc_serv*),
382 svc_thread_fn, int sig, struct module *);
383int svc_set_num_threads(struct svc_serv *, struct svc_pool *, int);
373void svc_destroy(struct svc_serv *); 384void svc_destroy(struct svc_serv *);
374int svc_process(struct svc_rqst *); 385int svc_process(struct svc_rqst *);
375int svc_register(struct svc_serv *, int, unsigned short); 386int svc_register(struct svc_serv *, int, unsigned short);