[Sheepdog] [PATCH v5 10/17] sheep: add begin_recover() hook to store.

Liu Yuan namei.unix at gmail.com
Fri Dec 30 14:07:05 CET 2011


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

We need to notify underlying store when the recovery begins.

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 sheep/sheep_priv.h |    1 +
 sheep/store.c      |    6 ++++++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/sheep/sheep_priv.h b/sheep/sheep_priv.h
index bee2cac..dbf3e03 100644
--- a/sheep/sheep_priv.h
+++ b/sheep/sheep_priv.h
@@ -177,6 +177,7 @@ struct store_driver {
 	int (*get_objlist)(struct siocb *);
 	int (*link)(uint64_t oid, struct siocb *, int tgt_epoch);
 	int (*atomic_put)(uint64_t oid, struct siocb *);
+	int (*begin_recover)(struct siocb *);
 };
 
 extern struct list_head store_drivers;
diff --git a/sheep/store.c b/sheep/store.c
index 201dbb5..4e9eb70 100644
--- a/sheep/store.c
+++ b/sheep/store.c
@@ -1803,6 +1803,12 @@ int start_recovery(uint32_t epoch)
 	rw->work.fn = do_recovery_work;
 	rw->work.done = do_recover_main;
 
+	if (sd_store->begin_recover) {
+		struct siocb iocb = { 0 };
+		iocb.epoch = epoch;
+		sd_store->begin_recover(&iocb);
+	}
+
 	if (recovering_work != NULL) {
 		if (next_rw) {
 			/* skip the previous epoch recovery */
-- 
1.7.8.rc3




More information about the sheepdog mailing list