Lines Matching refs:serv
38 static void svc_unregister(const struct svc_serv *serv, struct net *net);
40 #define svc_serv_is_pooled(serv) ((serv)->sv_ops->svo_function) argument
338 svc_pool_for_cpu(struct svc_serv *serv, int cpu) in svc_pool_for_cpu() argument
348 if (svc_serv_is_pooled(serv)) { in svc_pool_for_cpu()
358 return &serv->sv_pools[pidx % serv->sv_nrpools]; in svc_pool_for_cpu()
361 int svc_rpcb_setup(struct svc_serv *serv, struct net *net) in svc_rpcb_setup() argument
370 svc_unregister(serv, net); in svc_rpcb_setup()
375 void svc_rpcb_cleanup(struct svc_serv *serv, struct net *net) in svc_rpcb_cleanup() argument
377 svc_unregister(serv, net); in svc_rpcb_cleanup()
382 static int svc_uses_rpcbind(struct svc_serv *serv) in svc_uses_rpcbind() argument
387 for (progp = serv->sv_program; progp; progp = progp->pg_next) { in svc_uses_rpcbind()
399 int svc_bind(struct svc_serv *serv, struct net *net) in svc_bind() argument
401 if (!svc_uses_rpcbind(serv)) in svc_bind()
403 return svc_rpcb_setup(serv, net); in svc_bind()
409 __svc_init_bc(struct svc_serv *serv) in __svc_init_bc() argument
411 INIT_LIST_HEAD(&serv->sv_cb_list); in __svc_init_bc()
412 spin_lock_init(&serv->sv_cb_lock); in __svc_init_bc()
413 init_waitqueue_head(&serv->sv_cb_waitq); in __svc_init_bc()
417 __svc_init_bc(struct svc_serv *serv) in __svc_init_bc() argument
429 struct svc_serv *serv; in __svc_create() local
434 if (!(serv = kzalloc(sizeof(*serv), GFP_KERNEL))) in __svc_create()
436 serv->sv_name = prog->pg_name; in __svc_create()
437 serv->sv_program = prog; in __svc_create()
438 serv->sv_nrthreads = 1; in __svc_create()
439 serv->sv_stats = prog->pg_stats; in __svc_create()
442 serv->sv_max_payload = bufsize? bufsize : 4096; in __svc_create()
443 serv->sv_max_mesg = roundup(serv->sv_max_payload + PAGE_SIZE, PAGE_SIZE); in __svc_create()
444 serv->sv_ops = ops; in __svc_create()
458 serv->sv_xdrsize = xdrsize; in __svc_create()
459 INIT_LIST_HEAD(&serv->sv_tempsocks); in __svc_create()
460 INIT_LIST_HEAD(&serv->sv_permsocks); in __svc_create()
461 timer_setup(&serv->sv_temptimer, NULL, 0); in __svc_create()
462 spin_lock_init(&serv->sv_lock); in __svc_create()
464 __svc_init_bc(serv); in __svc_create()
466 serv->sv_nrpools = npools; in __svc_create()
467 serv->sv_pools = in __svc_create()
468 kcalloc(serv->sv_nrpools, sizeof(struct svc_pool), in __svc_create()
470 if (!serv->sv_pools) { in __svc_create()
471 kfree(serv); in __svc_create()
475 for (i = 0; i < serv->sv_nrpools; i++) { in __svc_create()
476 struct svc_pool *pool = &serv->sv_pools[i]; in __svc_create()
479 i, serv->sv_name); in __svc_create()
487 return serv; in __svc_create()
502 struct svc_serv *serv; in svc_create_pooled() local
505 serv = __svc_create(prog, bufsize, npools, ops); in svc_create_pooled()
506 if (!serv) in svc_create_pooled()
508 return serv; in svc_create_pooled()
515 void svc_shutdown_net(struct svc_serv *serv, struct net *net) in svc_shutdown_net() argument
517 svc_close_net(serv, net); in svc_shutdown_net()
519 if (serv->sv_ops->svo_shutdown) in svc_shutdown_net()
520 serv->sv_ops->svo_shutdown(serv, net); in svc_shutdown_net()
529 svc_destroy(struct svc_serv *serv) in svc_destroy() argument
532 serv->sv_program->pg_name, in svc_destroy()
533 serv->sv_nrthreads); in svc_destroy()
535 if (serv->sv_nrthreads) { in svc_destroy()
536 if (--(serv->sv_nrthreads) != 0) { in svc_destroy()
537 svc_sock_update_bufs(serv); in svc_destroy()
541 printk("svc_destroy: no threads for serv=%p!\n", serv); in svc_destroy()
543 del_timer_sync(&serv->sv_temptimer); in svc_destroy()
549 BUG_ON(!list_empty(&serv->sv_permsocks)); in svc_destroy()
550 BUG_ON(!list_empty(&serv->sv_tempsocks)); in svc_destroy()
552 cache_clean_deferred(serv); in svc_destroy()
554 if (svc_serv_is_pooled(serv)) in svc_destroy()
557 kfree(serv->sv_pools); in svc_destroy()
558 kfree(serv); in svc_destroy()
606 svc_rqst_alloc(struct svc_serv *serv, struct svc_pool *pool, int node) in svc_rqst_alloc() argument
616 rqstp->rq_server = serv; in svc_rqst_alloc()
623 rqstp->rq_argp = kmalloc_node(serv->sv_xdrsize, GFP_KERNEL, node); in svc_rqst_alloc()
627 rqstp->rq_resp = kmalloc_node(serv->sv_xdrsize, GFP_KERNEL, node); in svc_rqst_alloc()
631 if (!svc_init_buffer(rqstp, serv->sv_max_mesg, node)) in svc_rqst_alloc()
642 svc_prepare_thread(struct svc_serv *serv, struct svc_pool *pool, int node) in svc_prepare_thread() argument
646 rqstp = svc_rqst_alloc(serv, pool, node); in svc_prepare_thread()
650 serv->sv_nrthreads++; in svc_prepare_thread()
663 choose_pool(struct svc_serv *serv, struct svc_pool *pool, unsigned int *state) in choose_pool() argument
668 return &serv->sv_pools[(*state)++ % serv->sv_nrpools]; in choose_pool()
675 choose_victim(struct svc_serv *serv, struct svc_pool *pool, unsigned int *state) in choose_victim() argument
684 for (i = 0; i < serv->sv_nrpools; i++) { in choose_victim()
685 pool = &serv->sv_pools[--(*state) % serv->sv_nrpools]; in choose_victim()
714 svc_start_kthreads(struct svc_serv *serv, struct svc_pool *pool, int nrservs) in svc_start_kthreads() argument
719 unsigned int state = serv->sv_nrthreads-1; in svc_start_kthreads()
724 chosen_pool = choose_pool(serv, pool, &state); in svc_start_kthreads()
727 rqstp = svc_prepare_thread(serv, chosen_pool, node); in svc_start_kthreads()
731 __module_get(serv->sv_ops->svo_module); in svc_start_kthreads()
732 task = kthread_create_on_node(serv->sv_ops->svo_function, rqstp, in svc_start_kthreads()
733 node, "%s", serv->sv_name); in svc_start_kthreads()
735 module_put(serv->sv_ops->svo_module); in svc_start_kthreads()
741 if (serv->sv_nrpools > 1) in svc_start_kthreads()
744 svc_sock_update_bufs(serv); in svc_start_kthreads()
754 svc_signal_kthreads(struct svc_serv *serv, struct svc_pool *pool, int nrservs) in svc_signal_kthreads() argument
757 unsigned int state = serv->sv_nrthreads-1; in svc_signal_kthreads()
761 task = choose_victim(serv, pool, &state); in svc_signal_kthreads()
786 svc_set_num_threads(struct svc_serv *serv, struct svc_pool *pool, int nrservs) in svc_set_num_threads() argument
790 nrservs -= (serv->sv_nrthreads-1); in svc_set_num_threads()
798 return svc_start_kthreads(serv, pool, nrservs); in svc_set_num_threads()
800 return svc_signal_kthreads(serv, pool, nrservs); in svc_set_num_threads()
807 svc_stop_kthreads(struct svc_serv *serv, struct svc_pool *pool, int nrservs) in svc_stop_kthreads() argument
810 unsigned int state = serv->sv_nrthreads-1; in svc_stop_kthreads()
814 task = choose_victim(serv, pool, &state); in svc_stop_kthreads()
824 svc_set_num_threads_sync(struct svc_serv *serv, struct svc_pool *pool, int nrservs) in svc_set_num_threads_sync() argument
828 nrservs -= (serv->sv_nrthreads-1); in svc_set_num_threads_sync()
836 return svc_start_kthreads(serv, pool, nrservs); in svc_set_num_threads_sync()
838 return svc_stop_kthreads(serv, pool, nrservs); in svc_set_num_threads_sync()
884 struct svc_serv *serv = rqstp->rq_server; in svc_exit_thread() local
896 if (serv) in svc_exit_thread()
897 svc_destroy(serv); in svc_exit_thread()
1081 int svc_register(const struct svc_serv *serv, struct net *net, in svc_register() argument
1093 for (progp = serv->sv_program; progp; progp = progp->pg_next) { in svc_register()
1142 static void svc_unregister(const struct svc_serv *serv, struct net *net) in svc_unregister() argument
1150 for (progp = serv->sv_program; progp; progp = progp->pg_next) { in svc_unregister()
1289 struct svc_serv *serv = rqstp->rq_server; in svc_process_common() local
1327 for (progp = serv->sv_program; progp; progp = progp->pg_next) in svc_process_common()
1381 serv->sv_stats->rpccnt++; in svc_process_common()
1447 serv->sv_stats->rpcbadfmt++; in svc_process_common()
1460 serv->sv_stats->rpcbadauth++; in svc_process_common()
1470 serv->sv_stats->rpcbadfmt++; in svc_process_common()
1478 serv->sv_stats->rpcbadfmt++; in svc_process_common()
1487 serv->sv_stats->rpcbadfmt++; in svc_process_common()
1496 serv->sv_stats->rpcbadfmt++; in svc_process_common()
1509 struct svc_serv *serv = rqstp->rq_server; in svc_process() local
1537 serv->sv_stats->rpcbadfmt++; in svc_process()
1557 bc_svc_process(struct svc_serv *serv, struct rpc_rqst *req, in bc_svc_process() argument
1571 rqstp->rq_server = serv; in bc_svc_process()