Lines Matching refs:serv
36 static void svc_unregister(const struct svc_serv *serv, struct net *net);
38 #define svc_serv_is_pooled(serv) ((serv)->sv_ops->svo_function) argument
336 svc_pool_for_cpu(struct svc_serv *serv, int cpu) in svc_pool_for_cpu() argument
346 if (svc_serv_is_pooled(serv)) { in svc_pool_for_cpu()
356 return &serv->sv_pools[pidx % serv->sv_nrpools]; in svc_pool_for_cpu()
359 int svc_rpcb_setup(struct svc_serv *serv, struct net *net) in svc_rpcb_setup() argument
368 svc_unregister(serv, net); in svc_rpcb_setup()
373 void svc_rpcb_cleanup(struct svc_serv *serv, struct net *net) in svc_rpcb_cleanup() argument
375 svc_unregister(serv, net); in svc_rpcb_cleanup()
380 static int svc_uses_rpcbind(struct svc_serv *serv) in svc_uses_rpcbind() argument
385 for (progp = serv->sv_program; progp; progp = progp->pg_next) { in svc_uses_rpcbind()
397 int svc_bind(struct svc_serv *serv, struct net *net) in svc_bind() argument
399 if (!svc_uses_rpcbind(serv)) in svc_bind()
401 return svc_rpcb_setup(serv, net); in svc_bind()
407 __svc_init_bc(struct svc_serv *serv) in __svc_init_bc() argument
409 INIT_LIST_HEAD(&serv->sv_cb_list); in __svc_init_bc()
410 spin_lock_init(&serv->sv_cb_lock); in __svc_init_bc()
411 init_waitqueue_head(&serv->sv_cb_waitq); in __svc_init_bc()
415 __svc_init_bc(struct svc_serv *serv) in __svc_init_bc() argument
427 struct svc_serv *serv; in __svc_create() local
432 if (!(serv = kzalloc(sizeof(*serv), GFP_KERNEL))) in __svc_create()
434 serv->sv_name = prog->pg_name; in __svc_create()
435 serv->sv_program = prog; in __svc_create()
436 serv->sv_nrthreads = 1; in __svc_create()
437 serv->sv_stats = prog->pg_stats; in __svc_create()
440 serv->sv_max_payload = bufsize? bufsize : 4096; in __svc_create()
441 serv->sv_max_mesg = roundup(serv->sv_max_payload + PAGE_SIZE, PAGE_SIZE); in __svc_create()
442 serv->sv_ops = ops; in __svc_create()
456 serv->sv_xdrsize = xdrsize; in __svc_create()
457 INIT_LIST_HEAD(&serv->sv_tempsocks); in __svc_create()
458 INIT_LIST_HEAD(&serv->sv_permsocks); in __svc_create()
459 timer_setup(&serv->sv_temptimer, NULL, 0); in __svc_create()
460 spin_lock_init(&serv->sv_lock); in __svc_create()
462 __svc_init_bc(serv); in __svc_create()
464 serv->sv_nrpools = npools; in __svc_create()
465 serv->sv_pools = in __svc_create()
466 kcalloc(serv->sv_nrpools, sizeof(struct svc_pool), in __svc_create()
468 if (!serv->sv_pools) { in __svc_create()
469 kfree(serv); in __svc_create()
473 for (i = 0; i < serv->sv_nrpools; i++) { in __svc_create()
474 struct svc_pool *pool = &serv->sv_pools[i]; in __svc_create()
477 i, serv->sv_name); in __svc_create()
485 return serv; in __svc_create()
500 struct svc_serv *serv; in svc_create_pooled() local
503 serv = __svc_create(prog, bufsize, npools, ops); in svc_create_pooled()
504 if (!serv) in svc_create_pooled()
506 return serv; in svc_create_pooled()
513 void svc_shutdown_net(struct svc_serv *serv, struct net *net) in svc_shutdown_net() argument
515 svc_close_net(serv, net); in svc_shutdown_net()
517 if (serv->sv_ops->svo_shutdown) in svc_shutdown_net()
518 serv->sv_ops->svo_shutdown(serv, net); in svc_shutdown_net()
527 svc_destroy(struct svc_serv *serv) in svc_destroy() argument
530 serv->sv_program->pg_name, in svc_destroy()
531 serv->sv_nrthreads); in svc_destroy()
533 if (serv->sv_nrthreads) { in svc_destroy()
534 if (--(serv->sv_nrthreads) != 0) { in svc_destroy()
535 svc_sock_update_bufs(serv); in svc_destroy()
539 printk("svc_destroy: no threads for serv=%p!\n", serv); in svc_destroy()
541 del_timer_sync(&serv->sv_temptimer); in svc_destroy()
547 BUG_ON(!list_empty(&serv->sv_permsocks)); in svc_destroy()
548 BUG_ON(!list_empty(&serv->sv_tempsocks)); in svc_destroy()
550 cache_clean_deferred(serv); in svc_destroy()
552 if (svc_serv_is_pooled(serv)) in svc_destroy()
555 kfree(serv->sv_pools); in svc_destroy()
556 kfree(serv); in svc_destroy()
604 svc_rqst_alloc(struct svc_serv *serv, struct svc_pool *pool, int node) in svc_rqst_alloc() argument
614 rqstp->rq_server = serv; in svc_rqst_alloc()
617 rqstp->rq_argp = kmalloc_node(serv->sv_xdrsize, GFP_KERNEL, node); in svc_rqst_alloc()
621 rqstp->rq_resp = kmalloc_node(serv->sv_xdrsize, GFP_KERNEL, node); in svc_rqst_alloc()
625 if (!svc_init_buffer(rqstp, serv->sv_max_mesg, node)) in svc_rqst_alloc()
636 svc_prepare_thread(struct svc_serv *serv, struct svc_pool *pool, int node) in svc_prepare_thread() argument
640 rqstp = svc_rqst_alloc(serv, pool, node); in svc_prepare_thread()
644 serv->sv_nrthreads++; in svc_prepare_thread()
657 choose_pool(struct svc_serv *serv, struct svc_pool *pool, unsigned int *state) in choose_pool() argument
662 return &serv->sv_pools[(*state)++ % serv->sv_nrpools]; in choose_pool()
669 choose_victim(struct svc_serv *serv, struct svc_pool *pool, unsigned int *state) in choose_victim() argument
678 for (i = 0; i < serv->sv_nrpools; i++) { in choose_victim()
679 pool = &serv->sv_pools[--(*state) % serv->sv_nrpools]; in choose_victim()
708 svc_start_kthreads(struct svc_serv *serv, struct svc_pool *pool, int nrservs) in svc_start_kthreads() argument
713 unsigned int state = serv->sv_nrthreads-1; in svc_start_kthreads()
718 chosen_pool = choose_pool(serv, pool, &state); in svc_start_kthreads()
721 rqstp = svc_prepare_thread(serv, chosen_pool, node); in svc_start_kthreads()
725 __module_get(serv->sv_ops->svo_module); in svc_start_kthreads()
726 task = kthread_create_on_node(serv->sv_ops->svo_function, rqstp, in svc_start_kthreads()
727 node, "%s", serv->sv_name); in svc_start_kthreads()
729 module_put(serv->sv_ops->svo_module); in svc_start_kthreads()
735 if (serv->sv_nrpools > 1) in svc_start_kthreads()
738 svc_sock_update_bufs(serv); in svc_start_kthreads()
748 svc_signal_kthreads(struct svc_serv *serv, struct svc_pool *pool, int nrservs) in svc_signal_kthreads() argument
751 unsigned int state = serv->sv_nrthreads-1; in svc_signal_kthreads()
755 task = choose_victim(serv, pool, &state); in svc_signal_kthreads()
780 svc_set_num_threads(struct svc_serv *serv, struct svc_pool *pool, int nrservs) in svc_set_num_threads() argument
784 nrservs -= (serv->sv_nrthreads-1); in svc_set_num_threads()
792 return svc_start_kthreads(serv, pool, nrservs); in svc_set_num_threads()
794 return svc_signal_kthreads(serv, pool, nrservs); in svc_set_num_threads()
801 svc_stop_kthreads(struct svc_serv *serv, struct svc_pool *pool, int nrservs) in svc_stop_kthreads() argument
804 unsigned int state = serv->sv_nrthreads-1; in svc_stop_kthreads()
808 task = choose_victim(serv, pool, &state); in svc_stop_kthreads()
818 svc_set_num_threads_sync(struct svc_serv *serv, struct svc_pool *pool, int nrservs) in svc_set_num_threads_sync() argument
822 nrservs -= (serv->sv_nrthreads-1); in svc_set_num_threads_sync()
830 return svc_start_kthreads(serv, pool, nrservs); in svc_set_num_threads_sync()
832 return svc_stop_kthreads(serv, pool, nrservs); in svc_set_num_threads_sync()
855 struct svc_serv *serv = rqstp->rq_server; in svc_exit_thread() local
867 if (serv) in svc_exit_thread()
868 svc_destroy(serv); in svc_exit_thread()
1052 int svc_register(const struct svc_serv *serv, struct net *net, in svc_register() argument
1064 for (progp = serv->sv_program; progp; progp = progp->pg_next) { in svc_register()
1113 static void svc_unregister(const struct svc_serv *serv, struct net *net) in svc_unregister() argument
1121 for (progp = serv->sv_program; progp; progp = progp->pg_next) { in svc_unregister()
1276 struct svc_serv *serv = rqstp->rq_server; in svc_process_common() local
1314 for (progp = serv->sv_program; progp; progp = progp->pg_next) in svc_process_common()
1370 serv->sv_stats->rpccnt++; in svc_process_common()
1436 serv->sv_stats->rpcbadfmt++; in svc_process_common()
1448 serv->sv_stats->rpcbadauth++; in svc_process_common()
1458 serv->sv_stats->rpcbadfmt++; in svc_process_common()
1466 serv->sv_stats->rpcbadfmt++; in svc_process_common()
1475 serv->sv_stats->rpcbadfmt++; in svc_process_common()
1484 serv->sv_stats->rpcbadfmt++; in svc_process_common()
1497 struct svc_serv *serv = rqstp->rq_server; in svc_process() local
1519 serv->sv_stats->rpcbadfmt++; in svc_process()
1539 bc_svc_process(struct svc_serv *serv, struct rpc_rqst *req, in bc_svc_process() argument
1553 rqstp->rq_server = serv; in bc_svc_process()