[sheepdog] [PATCH 1/2] lib: add an interface for registering workqueue for libsheepdog
Hitoshi Mitake
mitake.hitoshi at lab.ntt.co.jp
Thu Oct 9 08:16:25 CEST 2014
purge_directory() of libsheepdog can call bunch of unlink(2), so it
can cause long request blocking because sheep process calls the
function in its main thread. For avoiding such a problem, this patch
add a new interface for registering workqueue used in util.c of
libsheepdog and let sheep use it.
Cc: Philip Crotwell <crotwell at seis.sc.edu>
Cc: Masahiro Tsuji <tuji at atworks.co.jp>
Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
include/util.h | 3 +++
lib/util.c | 8 ++++++++
sheep/sheep.c | 2 ++
3 files changed, 13 insertions(+)
diff --git a/include/util.h b/include/util.h
index 69e114b..6a513e0 100644
--- a/include/util.h
+++ b/include/util.h
@@ -575,4 +575,7 @@ static inline uint64_t clock_get_time(void)
char *xstrdup(const char *s);
+struct work_queue;
+void register_util_wq(struct work_queue *wq);
+
#endif
diff --git a/lib/util.c b/lib/util.c
index 164f755..82cf28c 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -21,6 +21,14 @@
#include <fcntl.h>
#include "util.h"
+#include "work.h"
+
+static struct work_queue *util_wqueue;
+
+void register_util_wq(struct work_queue *wq)
+{
+ util_wqueue = wq;
+}
mode_t sd_def_dmode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP;
mode_t sd_def_fmode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP;
diff --git a/sheep/sheep.c b/sheep/sheep.c
index 328a7fe..8c8645e 100644
--- a/sheep/sheep.c
+++ b/sheep/sheep.c
@@ -462,6 +462,8 @@ static int create_work_queues(void)
!sys->areq_wqueue)
return -1;
+ register_util_wq(sys->io_wqueue);
+
return 0;
}
--
1.9.1
More information about the sheepdog
mailing list