[sheepdog] [PATCH v2 2/4] object cache: add a push work queue

Liu Yuan namei.unix at gmail.com
Sun Jan 27 11:33:18 CET 2013


From: Liu Yuan <tailai.ly at taobao.com>

This is a prepare patch for 'optimize push phase of dirty objects'.

- Prefix work queues of object cache as 'oc_'.

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 sheep/object_cache.c |    2 +-
 sheep/sheep.c        |    5 +++--
 sheep/sheep_priv.h   |    3 ++-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/sheep/object_cache.c b/sheep/object_cache.c
index a35281d..1ae8820 100644
--- a/sheep/object_cache.c
+++ b/sheep/object_cache.c
@@ -572,7 +572,7 @@ void object_cache_try_to_reclaim(int delay)
 	rw->delay = delay;
 	rw->work.fn = do_reclaim;
 	rw->work.done = reclaim_done;
-	queue_work(sys->reclaim_wqueue, &rw->work);
+	queue_work(sys->oc_reclaim_wqueue, &rw->work);
 }
 
 static inline struct object_cache_entry *
diff --git a/sheep/sheep.c b/sheep/sheep.c
index 61e166c..380c661 100644
--- a/sheep/sheep.c
+++ b/sheep/sheep.c
@@ -374,8 +374,9 @@ static int init_work_queues(void)
 	sys->block_wqueue = init_work_queue("block", true);
 	sys->sockfd_wqueue = init_work_queue("sockfd", true);
 	if (is_object_cache_enabled()) {
-		sys->reclaim_wqueue = init_work_queue("reclaim", true);
-		if (!sys->reclaim_wqueue)
+		sys->oc_reclaim_wqueue = init_work_queue("oc_reclaim", true);
+		sys->oc_push_wqueue = init_work_queue("oc_push", false);
+		if (!sys->oc_reclaim_wqueue || !sys->oc_push_wqueue)
 			return -1;
 	}
 	if (!sys->gateway_wqueue || !sys->io_wqueue || !sys->recovery_wqueue ||
diff --git a/sheep/sheep_priv.h b/sheep/sheep_priv.h
index b19ca03..c48b686 100644
--- a/sheep/sheep_priv.h
+++ b/sheep/sheep_priv.h
@@ -113,7 +113,8 @@ struct cluster_info {
 	struct work_queue *recovery_notify_wqueue;
 	struct work_queue *block_wqueue;
 	struct work_queue *sockfd_wqueue;
-	struct work_queue *reclaim_wqueue;
+	struct work_queue *oc_reclaim_wqueue;
+	struct work_queue *oc_push_wqueue;
 
 #define CACHE_TYPE_OBJECT 0x1
 #define CACHE_TYPE_DISK   0x2
-- 
1.7.9.5




More information about the sheepdog mailing list