From: "J. Bruce Fields" <bfields@xxxxxxxxxx> No change in behavior, just trivial refactoring. Signed-off-by: J. Bruce Fields <bfields@xxxxxxxxxx> --- net/sunrpc/svc.c | 62 +++++++++++++++++++++++++++++------------------- 1 file changed, 37 insertions(+), 25 deletions(-) diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index e87ddb9f7feb..502e09a28f84 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c @@ -702,40 +702,52 @@ choose_victim(struct svc_serv *serv, struct svc_pool *pool, unsigned int *state) return task; } -/* create new threads */ static int -svc_start_kthreads(struct svc_serv *serv, struct svc_pool *pool, int nrservs) +svc_start_kthread(struct svc_serv *serv, struct svc_pool *pool, + unsigned int *state) { struct svc_rqst *rqstp; struct task_struct *task; struct svc_pool *chosen_pool; - unsigned int state = serv->sv_nrthreads-1; int node; - do { - nrservs--; - chosen_pool = choose_pool(serv, pool, &state); - - node = svc_pool_map_get_node(chosen_pool->sp_id); - rqstp = svc_prepare_thread(serv, chosen_pool, node); - if (IS_ERR(rqstp)) - return PTR_ERR(rqstp); - - __module_get(serv->sv_ops->svo_module); - task = kthread_create_on_node(serv->sv_ops->svo_function, rqstp, - node, "%s", serv->sv_name); - if (IS_ERR(task)) { - module_put(serv->sv_ops->svo_module); - svc_exit_thread(rqstp); - return PTR_ERR(task); - } + chosen_pool = choose_pool(serv, pool, state); - rqstp->rq_task = task; - if (serv->sv_nrpools > 1) - svc_pool_map_set_cpumask(task, chosen_pool->sp_id); + node = svc_pool_map_get_node(chosen_pool->sp_id); + rqstp = svc_prepare_thread(serv, chosen_pool, node); + if (IS_ERR(rqstp)) + return PTR_ERR(rqstp); - svc_sock_update_bufs(serv); - wake_up_process(task); + __module_get(serv->sv_ops->svo_module); + task = kthread_create_on_node(serv->sv_ops->svo_function, rqstp, + node, "%s", serv->sv_name); + if (IS_ERR(task)) { + module_put(serv->sv_ops->svo_module); + svc_exit_thread(rqstp); + return PTR_ERR(task); + } + + rqstp->rq_task = task; + if (serv->sv_nrpools > 1) + svc_pool_map_set_cpumask(task, chosen_pool->sp_id); + + svc_sock_update_bufs(serv); + wake_up_process(task); + return 0; +} + +/* create new threads */ +static int +svc_start_kthreads(struct svc_serv *serv, struct svc_pool *pool, int nrservs) +{ + unsigned int state = serv->sv_nrthreads-1; + int ret; + + do { + nrservs--; + ret = svc_start_kthread(serv, pool, &state); + if (ret) + return ret; } while (nrservs > 0); return 0; -- 2.20.1