[sheepdog] [PATCH] sheep: use short thread for recovery

levin li levin108 at gmail.com
Wed Aug 29 08:35:58 CEST 2012


From: levin li <xingke.lwp at taobao.com>

Most time sheep isn't in recovery state, so the two recovery work
queue recovery_wqueue/recovery_notify_wqueue stay there useless,
since we have short thread, we can save resource by creating the
thread when recovery needs

Signed-off-by: levin li <xingke.lwp at taobao.com>
---
 sheep/recovery.c |    2 +-
 sheep/sheep.c    |    3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/sheep/recovery.c b/sheep/recovery.c
index 521d58f..e5a41c3 100644
--- a/sheep/recovery.c
+++ b/sheep/recovery.c
@@ -377,7 +377,7 @@ static inline void finish_recovery(struct recovery_work *rw)
 	/* notify recovery completion to other nodes */
 	rw->work.fn = notify_recovery_completion_work;
 	rw->work.done = notify_recovery_completion_main;
-	queue_work(sys->recovery_notify_wqueue, &rw->work);
+	queue_work(sys->recovery_wqueue, &rw->work);
 
 	dprintf("recovery complete: new epoch %"PRIu32"\n",
 		sys->recovered_epoch);
diff --git a/sheep/sheep.c b/sheep/sheep.c
index 10c0501..ea25a05 100644
--- a/sheep/sheep.c
+++ b/sheep/sheep.c
@@ -369,8 +369,7 @@ int main(int argc, char **argv)
 
 	sys->gateway_wqueue = init_work_queue("gateway", false);
 	sys->io_wqueue = init_work_queue("io", false);
-	sys->recovery_wqueue = init_work_queue("recovery", true);
-	sys->recovery_notify_wqueue = init_work_queue("recovery notify", true);
+	sys->recovery_wqueue = init_work_queue("recovery", false);
 	sys->deletion_wqueue = init_work_queue("deletion", true);
 	sys->block_wqueue = init_work_queue("block", true);
 	sys->sockfd_wqueue = init_work_queue("sockfd", true);
-- 
1.7.1




More information about the sheepdog mailing list