[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1549656647-25115-6-git-send-email-bfields@redhat.com>
Date: Fri, 8 Feb 2019 15:10:45 -0500
From: "J. Bruce Fields" <bfields@...hat.com>
To: linux-nfs@...r.kernel.org
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
Trond Myklebust <trondmy@...merspace.com>,
Jeff Layton <jlayton@...hat.com>,
David Howells <dhowells@...hat.com>, Tejun Heo <tj@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Shaohua Li <shli@...com>, Oleg Nesterov <oleg@...hat.com>,
"J. Bruce Fields" <bfields@...hat.com>
Subject: [PATCH 5/7] rpc: separate out body of svc_start_kthreads
From: "J. Bruce Fields" <bfields@...hat.com>
No change in behavior, just trivial refactoring.
Signed-off-by: J. Bruce Fields <bfields@...hat.com>
---
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
Powered by blists - more mailing lists