[sheepdog] [PATCH v4 05/10] work: initialize nr_nodes in init_work_queue()

MORITA Kazutaka morita.kazutaka at gmail.com
Tue May 14 09:00:14 CEST 2013


From: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>

With this patch, collie can create an appropriate size of worker
threads for dynamic work queues at the start time.

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 lib/work.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/work.c b/lib/work.c
index 1a90561..cf92096 100644
--- a/lib/work.c
+++ b/lib/work.c
@@ -263,6 +263,9 @@ int init_work_queue(size_t (*get_nr_nodes)(void), void (*create_cb)(pthread_t),
 	wq_create_cb = create_cb;
 	wq_destroy_cb = destroy_cb;
 
+	if (wq_get_nr_nodes)
+		nr_nodes = wq_get_nr_nodes();
+
 	efd = eventfd(0, EFD_NONBLOCK);
 	if (efd < 0) {
 		sd_eprintf("failed to create an event fd: %m");
-- 
1.7.9.5




More information about the sheepdog mailing list