Lines Matching refs:serv

35 static void svc_unregister(const struct svc_serv *serv, struct net *net);
37 #define svc_serv_is_pooled(serv) ((serv)->sv_ops->svo_function) argument
335 svc_pool_for_cpu(struct svc_serv *serv, int cpu) in svc_pool_for_cpu() argument
345 if (svc_serv_is_pooled(serv)) { in svc_pool_for_cpu()
355 return &serv->sv_pools[pidx % serv->sv_nrpools]; in svc_pool_for_cpu()
358 int svc_rpcb_setup(struct svc_serv *serv, struct net *net) in svc_rpcb_setup() argument
367 svc_unregister(serv, net); in svc_rpcb_setup()
372 void svc_rpcb_cleanup(struct svc_serv *serv, struct net *net) in svc_rpcb_cleanup() argument
374 svc_unregister(serv, net); in svc_rpcb_cleanup()
379 static int svc_uses_rpcbind(struct svc_serv *serv) in svc_uses_rpcbind() argument
384 for (progp = serv->sv_program; progp; progp = progp->pg_next) { in svc_uses_rpcbind()
396 int svc_bind(struct svc_serv *serv, struct net *net) in svc_bind() argument
398 if (!svc_uses_rpcbind(serv)) in svc_bind()
400 return svc_rpcb_setup(serv, net); in svc_bind()
406 __svc_init_bc(struct svc_serv *serv) in __svc_init_bc() argument
408 INIT_LIST_HEAD(&serv->sv_cb_list); in __svc_init_bc()
409 spin_lock_init(&serv->sv_cb_lock); in __svc_init_bc()
410 init_waitqueue_head(&serv->sv_cb_waitq); in __svc_init_bc()
414 __svc_init_bc(struct svc_serv *serv) in __svc_init_bc() argument
426 struct svc_serv *serv; in __svc_create() local
431 if (!(serv = kzalloc(sizeof(*serv), GFP_KERNEL))) in __svc_create()
433 serv->sv_name = prog->pg_name; in __svc_create()
434 serv->sv_program = prog; in __svc_create()
435 serv->sv_nrthreads = 1; in __svc_create()
436 serv->sv_stats = prog->pg_stats; in __svc_create()
439 serv->sv_max_payload = bufsize? bufsize : 4096; in __svc_create()
440 serv->sv_max_mesg = roundup(serv->sv_max_payload + PAGE_SIZE, PAGE_SIZE); in __svc_create()
441 serv->sv_ops = ops; in __svc_create()
455 serv->sv_xdrsize = xdrsize; in __svc_create()
456 INIT_LIST_HEAD(&serv->sv_tempsocks); in __svc_create()
457 INIT_LIST_HEAD(&serv->sv_permsocks); in __svc_create()
458 timer_setup(&serv->sv_temptimer, NULL, 0); in __svc_create()
459 spin_lock_init(&serv->sv_lock); in __svc_create()
461 __svc_init_bc(serv); in __svc_create()
463 serv->sv_nrpools = npools; in __svc_create()
464 serv->sv_pools = in __svc_create()
465 kcalloc(serv->sv_nrpools, sizeof(struct svc_pool), in __svc_create()
467 if (!serv->sv_pools) { in __svc_create()
468 kfree(serv); in __svc_create()
472 for (i = 0; i < serv->sv_nrpools; i++) { in __svc_create()
473 struct svc_pool *pool = &serv->sv_pools[i]; in __svc_create()
476 i, serv->sv_name); in __svc_create()
484 return serv; in __svc_create()
499 struct svc_serv *serv; in svc_create_pooled() local
502 serv = __svc_create(prog, bufsize, npools, ops); in svc_create_pooled()
503 if (!serv) in svc_create_pooled()
505 return serv; in svc_create_pooled()
512 void svc_shutdown_net(struct svc_serv *serv, struct net *net) in svc_shutdown_net() argument
514 svc_close_net(serv, net); in svc_shutdown_net()
516 if (serv->sv_ops->svo_shutdown) in svc_shutdown_net()
517 serv->sv_ops->svo_shutdown(serv, net); in svc_shutdown_net()
526 svc_destroy(struct svc_serv *serv) in svc_destroy() argument
529 serv->sv_program->pg_name, in svc_destroy()
530 serv->sv_nrthreads); in svc_destroy()
532 if (serv->sv_nrthreads) { in svc_destroy()
533 if (--(serv->sv_nrthreads) != 0) { in svc_destroy()
534 svc_sock_update_bufs(serv); in svc_destroy()
538 printk("svc_destroy: no threads for serv=%p!\n", serv); in svc_destroy()
540 del_timer_sync(&serv->sv_temptimer); in svc_destroy()
546 BUG_ON(!list_empty(&serv->sv_permsocks)); in svc_destroy()
547 BUG_ON(!list_empty(&serv->sv_tempsocks)); in svc_destroy()
549 cache_clean_deferred(serv); in svc_destroy()
551 if (svc_serv_is_pooled(serv)) in svc_destroy()
554 kfree(serv->sv_pools); in svc_destroy()
555 kfree(serv); in svc_destroy()
603 svc_rqst_alloc(struct svc_serv *serv, struct svc_pool *pool, int node) in svc_rqst_alloc() argument
613 rqstp->rq_server = serv; in svc_rqst_alloc()
616 rqstp->rq_argp = kmalloc_node(serv->sv_xdrsize, GFP_KERNEL, node); in svc_rqst_alloc()
620 rqstp->rq_resp = kmalloc_node(serv->sv_xdrsize, GFP_KERNEL, node); in svc_rqst_alloc()
624 if (!svc_init_buffer(rqstp, serv->sv_max_mesg, node)) in svc_rqst_alloc()
635 svc_prepare_thread(struct svc_serv *serv, struct svc_pool *pool, int node) in svc_prepare_thread() argument
639 rqstp = svc_rqst_alloc(serv, pool, node); in svc_prepare_thread()
643 serv->sv_nrthreads++; in svc_prepare_thread()
656 choose_pool(struct svc_serv *serv, struct svc_pool *pool, unsigned int *state) in choose_pool() argument
661 return &serv->sv_pools[(*state)++ % serv->sv_nrpools]; in choose_pool()
668 choose_victim(struct svc_serv *serv, struct svc_pool *pool, unsigned int *state) in choose_victim() argument
677 for (i = 0; i < serv->sv_nrpools; i++) { in choose_victim()
678 pool = &serv->sv_pools[--(*state) % serv->sv_nrpools]; in choose_victim()
707 svc_start_kthreads(struct svc_serv *serv, struct svc_pool *pool, int nrservs) in svc_start_kthreads() argument
712 unsigned int state = serv->sv_nrthreads-1; in svc_start_kthreads()
717 chosen_pool = choose_pool(serv, pool, &state); in svc_start_kthreads()
720 rqstp = svc_prepare_thread(serv, chosen_pool, node); in svc_start_kthreads()
724 __module_get(serv->sv_ops->svo_module); in svc_start_kthreads()
725 task = kthread_create_on_node(serv->sv_ops->svo_function, rqstp, in svc_start_kthreads()
726 node, "%s", serv->sv_name); in svc_start_kthreads()
728 module_put(serv->sv_ops->svo_module); in svc_start_kthreads()
734 if (serv->sv_nrpools > 1) in svc_start_kthreads()
737 svc_sock_update_bufs(serv); in svc_start_kthreads()
747 svc_signal_kthreads(struct svc_serv *serv, struct svc_pool *pool, int nrservs) in svc_signal_kthreads() argument
750 unsigned int state = serv->sv_nrthreads-1; in svc_signal_kthreads()
754 task = choose_victim(serv, pool, &state); in svc_signal_kthreads()
779 svc_set_num_threads(struct svc_serv *serv, struct svc_pool *pool, int nrservs) in svc_set_num_threads() argument
783 nrservs -= (serv->sv_nrthreads-1); in svc_set_num_threads()
791 return svc_start_kthreads(serv, pool, nrservs); in svc_set_num_threads()
793 return svc_signal_kthreads(serv, pool, nrservs); in svc_set_num_threads()
800 svc_stop_kthreads(struct svc_serv *serv, struct svc_pool *pool, int nrservs) in svc_stop_kthreads() argument
803 unsigned int state = serv->sv_nrthreads-1; in svc_stop_kthreads()
807 task = choose_victim(serv, pool, &state); in svc_stop_kthreads()
817 svc_set_num_threads_sync(struct svc_serv *serv, struct svc_pool *pool, int nrservs) in svc_set_num_threads_sync() argument
821 nrservs -= (serv->sv_nrthreads-1); in svc_set_num_threads_sync()
829 return svc_start_kthreads(serv, pool, nrservs); in svc_set_num_threads_sync()
831 return svc_stop_kthreads(serv, pool, nrservs); in svc_set_num_threads_sync()
854 struct svc_serv *serv = rqstp->rq_server; in svc_exit_thread() local
866 if (serv) in svc_exit_thread()
867 svc_destroy(serv); in svc_exit_thread()
1006 int svc_register(const struct svc_serv *serv, struct net *net, in svc_register() argument
1019 for (progp = serv->sv_program; progp; progp = progp->pg_next) { in svc_register()
1097 static void svc_unregister(const struct svc_serv *serv, struct net *net) in svc_unregister() argument
1105 for (progp = serv->sv_program; progp; progp = progp->pg_next) { in svc_unregister()
1156 struct svc_serv *serv = rqstp->rq_server; in svc_process_common() local
1196 for (progp = serv->sv_program; progp; progp = progp->pg_next) in svc_process_common()
1257 serv->sv_stats->rpccnt++; in svc_process_common()
1350 serv->sv_stats->rpcbadfmt++; in svc_process_common()
1359 serv->sv_stats->rpcbadauth++; in svc_process_common()
1369 serv->sv_stats->rpcbadfmt++; in svc_process_common()
1377 serv->sv_stats->rpcbadfmt++; in svc_process_common()
1386 serv->sv_stats->rpcbadfmt++; in svc_process_common()
1395 serv->sv_stats->rpcbadfmt++; in svc_process_common()
1408 struct svc_serv *serv = rqstp->rq_server; in svc_process() local
1430 serv->sv_stats->rpcbadfmt++; in svc_process()
1450 bc_svc_process(struct svc_serv *serv, struct rpc_rqst *req, in bc_svc_process() argument
1462 rqstp->rq_xprt = serv->sv_bc_xprt; in bc_svc_process()
1465 rqstp->rq_server = serv; in bc_svc_process()