[sheepdog] [PATCH v4 02/10] work: rename init_wqueue_eventfd and init_work_queue
MORITA Kazutaka
morita.kazutaka at gmail.com
Tue May 14 09:00:11 CEST 2013
From: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
init_wqueue_eventfd() is not appropriate for a global name because we
don't have to know that the work queue uses eventfd outside of work.c.
This renames init_wqueue_eventfd() to init_work_queue(), and
init_work_queue() to create_work_queue().
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
sheep/sheep.c | 25 +++++++++++++------------
sheep/work.c | 9 +++++----
sheep/work.h | 6 +++---
3 files changed, 21 insertions(+), 19 deletions(-)
diff --git a/sheep/sheep.c b/sheep/sheep.c
index 868f018..537c86e 100644
--- a/sheep/sheep.c
+++ b/sheep/sheep.c
@@ -331,21 +331,22 @@ static void init_io_arg(char *arg)
}
}
-static int init_work_queues(void)
+static int create_work_queues(void)
{
- if (init_wqueue_eventfd())
+ if (init_work_queue())
return -1;
- sys->gateway_wqueue = init_work_queue("gway", WQ_UNLIMITED);
- sys->io_wqueue = init_work_queue("io", WQ_UNLIMITED);
- sys->recovery_wqueue = init_ordered_work_queue("rw");
- sys->deletion_wqueue = init_ordered_work_queue("deletion");
- sys->block_wqueue = init_ordered_work_queue("block");
- sys->sockfd_wqueue = init_ordered_work_queue("sockfd");
- sys->md_wqueue = init_ordered_work_queue("md");
+ sys->gateway_wqueue = create_work_queue("gway", WQ_UNLIMITED);
+ sys->io_wqueue = create_work_queue("io", WQ_UNLIMITED);
+ sys->recovery_wqueue = create_ordered_work_queue("rw");
+ sys->deletion_wqueue = create_ordered_work_queue("deletion");
+ sys->block_wqueue = create_ordered_work_queue("block");
+ sys->sockfd_wqueue = create_ordered_work_queue("sockfd");
+ sys->md_wqueue = create_ordered_work_queue("md");
if (sys->enable_object_cache) {
- sys->oc_reclaim_wqueue = init_ordered_work_queue("oc_reclaim");
- sys->oc_push_wqueue = init_work_queue("oc_push", WQ_DYNAMIC);
+ sys->oc_reclaim_wqueue =
+ create_ordered_work_queue("oc_reclaim");
+ sys->oc_push_wqueue = create_work_queue("oc_push", WQ_DYNAMIC);
if (!sys->oc_reclaim_wqueue || !sys->oc_push_wqueue)
return -1;
}
@@ -734,7 +735,7 @@ int main(int argc, char **argv)
* e.g, signal handling, above this call and those need multi-threaded
* environment, for e.g, work queues below.
*/
- ret = init_work_queues();
+ ret = create_work_queues();
if (ret)
exit(1);
diff --git a/sheep/work.c b/sheep/work.c
index 1e663d5..f79dd1d 100644
--- a/sheep/work.c
+++ b/sheep/work.c
@@ -260,7 +260,7 @@ retest:
pthread_exit(NULL);
}
-int init_wqueue_eventfd(void)
+int init_work_queue(void)
{
int ret;
@@ -291,7 +291,8 @@ int init_wqueue_eventfd(void)
* local requests that ask for creation of another thread to execute the
* requests and sleep-wait for responses.
*/
-struct work_queue *init_work_queue(const char *name, enum wq_thread_control tc)
+struct work_queue *create_work_queue(const char *name,
+ enum wq_thread_control tc)
{
int ret;
struct worker_info *wi;
@@ -326,7 +327,7 @@ destroy_threads:
return NULL;
}
-struct work_queue *init_ordered_work_queue(const char *name)
+struct work_queue *create_ordered_work_queue(const char *name)
{
- return init_work_queue(name, WQ_ORDERED);
+ return create_work_queue(name, WQ_ORDERED);
}
diff --git a/sheep/work.h b/sheep/work.h
index 90aa570..b036e3a 100644
--- a/sheep/work.h
+++ b/sheep/work.h
@@ -24,9 +24,9 @@ enum wq_thread_control {
WQ_UNLIMITED, /* Unlimited # of threads created */
};
-struct work_queue *init_work_queue(const char *name, enum wq_thread_control);
-struct work_queue *init_ordered_work_queue(const char *name);
+int init_work_queue(void);
+struct work_queue *create_work_queue(const char *name, enum wq_thread_control);
+struct work_queue *create_ordered_work_queue(const char *name);
void queue_work(struct work_queue *q, struct work *work);
-int init_wqueue_eventfd(void);
#endif
--
1.7.9.5
More information about the sheepdog
mailing list