[sheepdog] [PATCH 1/2] farm: call farm_end_recover in worker thread
MORITA Kazutaka
morita.kazutaka at lab.ntt.co.jp
Tue Aug 7 15:11:27 CEST 2012
When there are many stale objects, farm_end_recover() could issue a
lot of I/Os to move the objects from the working directory to the
backend store. We should call the function in the worker thread to
avoid sleeping long time in the main thread.
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
sheep/recovery.c | 28 +++++++++++++++++++++++-----
1 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/sheep/recovery.c b/sheep/recovery.c
index 5164aa7..c839b2b 100644
--- a/sheep/recovery.c
+++ b/sheep/recovery.c
@@ -337,20 +337,38 @@ static inline void run_next_rw(struct recovery_work *rw)
dprintf("recovery work is superseded\n");
}
-static inline void finish_recovery(struct recovery_work *rw)
+static void finish_recovery_work(struct work *work)
{
- recovering_work = NULL;
- sys->recovered_epoch = rw->epoch;
-
+ struct recovery_work *rw = container_of(work, struct recovery_work,
+ work);
if (sd_store->end_recover)
sd_store->end_recover(sys->epoch - 1, rw->old_vinfo);
+}
- free_recovery_work(rw);
+static void finish_recovery_main(struct work *work)
+{
+ struct recovery_work *rw = container_of(work, struct recovery_work,
+ work);
+ recovering_work = NULL;
+
+ sys->recovered_epoch = rw->epoch;
+
+ if (next_rw)
+ run_next_rw(rw);
+ else
+ free_recovery_work(rw);
dprintf("recovery complete: new epoch %"PRIu32"\n",
sys->recovered_epoch);
}
+static void finish_recovery(struct recovery_work *rw)
+{
+ rw->work.fn = finish_recovery_work;
+ rw->work.done = finish_recovery_main;;
+ queue_work(sys->recovery_wqueue, &rw->work);
+}
+
static inline bool oid_in_prio_oids(struct recovery_work *rw, uint64_t oid)
{
int i;
--
1.7.2.5
More information about the sheepdog
mailing list