[sheepdog] [PATCH v4 01/10] work: move some globals into work.c

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


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

Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
 sheep/work.c |   26 +++++++++++++++++++++++++-
 sheep/work.h |   27 ---------------------------
 2 files changed, 25 insertions(+), 28 deletions(-)

diff --git a/sheep/work.c b/sheep/work.c
index 41c03a9..1e663d5 100644
--- a/sheep/work.c
+++ b/sheep/work.c
@@ -42,8 +42,32 @@
  */
 #define WQ_PROTECTION_PERIOD 1000 /* ms */
 
+struct worker_info {
+	const char *name;
+
+	struct list_head finished_list;
+	struct list_head worker_info_siblings;
+
+	pthread_mutex_t finished_lock;
+	pthread_mutex_t startup_lock;
+
+	/* wokers sleep on this and signaled by tgtd */
+	pthread_cond_t pending_cond;
+	/* locked by tgtd and workers */
+	pthread_mutex_t pending_lock;
+	/* protected by pending_lock */
+	struct work_queue q;
+	size_t nr_pending;
+	size_t nr_running;
+	size_t nr_threads;
+	/* we cannot shrink work queue till this time */
+	uint64_t tm_end_of_protection;
+	enum wq_thread_control tc;
+	size_t nr_nodes;
+};
+
 static int efd;
-LIST_HEAD(worker_info_list);
+static LIST_HEAD(worker_info_list);
 
 static void *worker_routine(void *arg);
 
diff --git a/sheep/work.h b/sheep/work.h
index eee41be..90aa570 100644
--- a/sheep/work.h
+++ b/sheep/work.h
@@ -4,7 +4,6 @@
 #include <stdbool.h>
 
 struct work;
-struct work_queue;
 
 typedef void (*work_func_t)(struct work *);
 
@@ -25,32 +24,6 @@ enum wq_thread_control {
 	WQ_UNLIMITED, /* Unlimited # of threads created */
 };
 
-struct worker_info {
-	const char *name;
-
-	struct list_head finished_list;
-	struct list_head worker_info_siblings;
-
-	pthread_mutex_t finished_lock;
-	pthread_mutex_t startup_lock;
-
-	/* wokers sleep on this and signaled by tgtd */
-	pthread_cond_t pending_cond;
-	/* locked by tgtd and workers */
-	pthread_mutex_t pending_lock;
-	/* protected by pending_lock */
-	struct work_queue q;
-	size_t nr_pending;
-	size_t nr_running;
-	size_t nr_threads;
-	/* we cannot shrink work queue till this time */
-	uint64_t tm_end_of_protection;
-	enum wq_thread_control tc;
-	size_t nr_nodes;
-};
-
-extern struct list_head worker_info_list;
-
 struct work_queue *init_work_queue(const char *name, enum wq_thread_control);
 struct work_queue *init_ordered_work_queue(const char *name);
 void queue_work(struct work_queue *q, struct work *work);
-- 
1.7.9.5




More information about the sheepdog mailing list