Lines Matching refs:serv

38 static void svc_unregister(const struct svc_serv *serv, struct net *net);
370 struct svc_pool *svc_pool_for_cpu(struct svc_serv *serv) in svc_pool_for_cpu() argument
376 if (serv->sv_nrpools <= 1) in svc_pool_for_cpu()
377 return serv->sv_pools; in svc_pool_for_cpu()
388 return &serv->sv_pools[pidx % serv->sv_nrpools]; in svc_pool_for_cpu()
391 int svc_rpcb_setup(struct svc_serv *serv, struct net *net) in svc_rpcb_setup() argument
400 svc_unregister(serv, net); in svc_rpcb_setup()
405 void svc_rpcb_cleanup(struct svc_serv *serv, struct net *net) in svc_rpcb_cleanup() argument
407 svc_unregister(serv, net); in svc_rpcb_cleanup()
412 static int svc_uses_rpcbind(struct svc_serv *serv) in svc_uses_rpcbind() argument
417 for (progp = serv->sv_program; progp; progp = progp->pg_next) { in svc_uses_rpcbind()
429 int svc_bind(struct svc_serv *serv, struct net *net) in svc_bind() argument
431 if (!svc_uses_rpcbind(serv)) in svc_bind()
433 return svc_rpcb_setup(serv, net); in svc_bind()
439 __svc_init_bc(struct svc_serv *serv) in __svc_init_bc() argument
441 INIT_LIST_HEAD(&serv->sv_cb_list); in __svc_init_bc()
442 spin_lock_init(&serv->sv_cb_lock); in __svc_init_bc()
443 init_waitqueue_head(&serv->sv_cb_waitq); in __svc_init_bc()
447 __svc_init_bc(struct svc_serv *serv) in __svc_init_bc() argument
459 struct svc_serv *serv; in __svc_create() local
464 if (!(serv = kzalloc(sizeof(*serv), GFP_KERNEL))) in __svc_create()
466 serv->sv_name = prog->pg_name; in __svc_create()
467 serv->sv_program = prog; in __svc_create()
468 kref_init(&serv->sv_refcnt); in __svc_create()
469 serv->sv_stats = prog->pg_stats; in __svc_create()
472 serv->sv_max_payload = bufsize? bufsize : 4096; in __svc_create()
473 serv->sv_max_mesg = roundup(serv->sv_max_payload + PAGE_SIZE, PAGE_SIZE); in __svc_create()
474 serv->sv_threadfn = threadfn; in __svc_create()
488 serv->sv_xdrsize = xdrsize; in __svc_create()
489 INIT_LIST_HEAD(&serv->sv_tempsocks); in __svc_create()
490 INIT_LIST_HEAD(&serv->sv_permsocks); in __svc_create()
491 timer_setup(&serv->sv_temptimer, NULL, 0); in __svc_create()
492 spin_lock_init(&serv->sv_lock); in __svc_create()
494 __svc_init_bc(serv); in __svc_create()
496 serv->sv_nrpools = npools; in __svc_create()
497 serv->sv_pools = in __svc_create()
498 kcalloc(serv->sv_nrpools, sizeof(struct svc_pool), in __svc_create()
500 if (!serv->sv_pools) { in __svc_create()
501 kfree(serv); in __svc_create()
505 for (i = 0; i < serv->sv_nrpools; i++) { in __svc_create()
506 struct svc_pool *pool = &serv->sv_pools[i]; in __svc_create()
509 i, serv->sv_name); in __svc_create()
521 return serv; in __svc_create()
551 struct svc_serv *serv; in svc_create_pooled() local
554 serv = __svc_create(prog, bufsize, npools, threadfn); in svc_create_pooled()
555 if (!serv) in svc_create_pooled()
557 return serv; in svc_create_pooled()
571 struct svc_serv *serv = container_of(ref, struct svc_serv, sv_refcnt); in svc_destroy() local
574 dprintk("svc: svc_destroy(%s)\n", serv->sv_program->pg_name); in svc_destroy()
575 timer_shutdown_sync(&serv->sv_temptimer); in svc_destroy()
581 BUG_ON(!list_empty(&serv->sv_permsocks)); in svc_destroy()
582 BUG_ON(!list_empty(&serv->sv_tempsocks)); in svc_destroy()
584 cache_clean_deferred(serv); in svc_destroy()
586 svc_pool_map_put(serv->sv_nrpools); in svc_destroy()
588 for (i = 0; i < serv->sv_nrpools; i++) { in svc_destroy()
589 struct svc_pool *pool = &serv->sv_pools[i]; in svc_destroy()
595 kfree(serv->sv_pools); in svc_destroy()
596 kfree(serv); in svc_destroy()
635 svc_rqst_alloc(struct svc_serv *serv, struct svc_pool *pool, int node) in svc_rqst_alloc() argument
646 rqstp->rq_server = serv; in svc_rqst_alloc()
653 rqstp->rq_argp = kmalloc_node(serv->sv_xdrsize, GFP_KERNEL, node); in svc_rqst_alloc()
657 rqstp->rq_resp = kmalloc_node(serv->sv_xdrsize, GFP_KERNEL, node); in svc_rqst_alloc()
661 if (!svc_init_buffer(rqstp, serv->sv_max_mesg, node)) in svc_rqst_alloc()
672 svc_prepare_thread(struct svc_serv *serv, struct svc_pool *pool, int node) in svc_prepare_thread() argument
676 rqstp = svc_rqst_alloc(serv, pool, node); in svc_prepare_thread()
680 svc_get(serv); in svc_prepare_thread()
681 spin_lock_bh(&serv->sv_lock); in svc_prepare_thread()
682 serv->sv_nrthreads += 1; in svc_prepare_thread()
683 spin_unlock_bh(&serv->sv_lock); in svc_prepare_thread()
723 svc_pool_next(struct svc_serv *serv, struct svc_pool *pool, unsigned int *state) in svc_pool_next() argument
725 return pool ? pool : &serv->sv_pools[(*state)++ % serv->sv_nrpools]; in svc_pool_next()
729 svc_pool_victim(struct svc_serv *serv, struct svc_pool *pool, unsigned int *state) in svc_pool_victim() argument
737 for (i = 0; i < serv->sv_nrpools; i++) { in svc_pool_victim()
738 pool = &serv->sv_pools[--(*state) % serv->sv_nrpools]; in svc_pool_victim()
761 svc_start_kthreads(struct svc_serv *serv, struct svc_pool *pool, int nrservs) in svc_start_kthreads() argument
766 unsigned int state = serv->sv_nrthreads-1; in svc_start_kthreads()
771 chosen_pool = svc_pool_next(serv, pool, &state); in svc_start_kthreads()
774 rqstp = svc_prepare_thread(serv, chosen_pool, node); in svc_start_kthreads()
777 task = kthread_create_on_node(serv->sv_threadfn, rqstp, in svc_start_kthreads()
778 node, "%s", serv->sv_name); in svc_start_kthreads()
785 if (serv->sv_nrpools > 1) in svc_start_kthreads()
788 svc_sock_update_bufs(serv); in svc_start_kthreads()
796 svc_stop_kthreads(struct svc_serv *serv, struct svc_pool *pool, int nrservs) in svc_stop_kthreads() argument
800 unsigned int state = serv->sv_nrthreads-1; in svc_stop_kthreads()
803 task = svc_pool_victim(serv, pool, &state); in svc_stop_kthreads()
833 svc_set_num_threads(struct svc_serv *serv, struct svc_pool *pool, int nrservs) in svc_set_num_threads() argument
836 nrservs -= serv->sv_nrthreads; in svc_set_num_threads()
844 return svc_start_kthreads(serv, pool, nrservs); in svc_set_num_threads()
846 return svc_stop_kthreads(serv, pool, nrservs); in svc_set_num_threads()
924 struct svc_serv *serv = rqstp->rq_server; in svc_exit_thread() local
933 spin_lock_bh(&serv->sv_lock); in svc_exit_thread()
934 serv->sv_nrthreads -= 1; in svc_exit_thread()
935 spin_unlock_bh(&serv->sv_lock); in svc_exit_thread()
936 svc_sock_update_bufs(serv); in svc_exit_thread()
940 svc_put(serv); in svc_exit_thread()
1124 int svc_register(const struct svc_serv *serv, struct net *net, in svc_register() argument
1136 for (progp = serv->sv_program; progp; progp = progp->pg_next) { in svc_register()
1185 static void svc_unregister(const struct svc_serv *serv, struct net *net) in svc_unregister() argument
1194 for (progp = serv->sv_program; progp; progp = progp->pg_next) { in svc_unregister()
1298 struct svc_serv *serv = rqstp->rq_server; in svc_process_common() local
1328 for (progp = serv->sv_program; progp; progp = progp->pg_next) in svc_process_common()
1382 serv->sv_stats->rpccnt++; in svc_process_common()
1434 serv->sv_stats->rpcbadfmt++; in svc_process_common()
1445 serv->sv_stats->rpcbadauth++; in svc_process_common()
1455 serv->sv_stats->rpcbadfmt++; in svc_process_common()
1463 serv->sv_stats->rpcbadfmt++; in svc_process_common()
1477 serv->sv_stats->rpcbadfmt++; in svc_process_common()
1484 serv->sv_stats->rpcbadfmt++; in svc_process_common()
1489 serv->sv_stats->rpcbadfmt++; in svc_process_common()
1552 bc_svc_process(struct svc_serv *serv, struct rpc_rqst *req, in bc_svc_process() argument
1564 rqstp->rq_server = serv; in bc_svc_process()