]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: flush pg on activate _after_ we queue our transaction
authorSage Weil <sage@newdream.net>
Sun, 12 Feb 2012 05:47:42 +0000 (21:47 -0800)
committerSage Weil <sage@newdream.net>
Sun, 12 Feb 2012 05:47:42 +0000 (21:47 -0800)
We recently added a flush on activate, but we are still building the
transaction (the caller queues it), so calling osr.flush() here is totally
useless.

Instead, set a flag 'need_flush', and do the flush the next time we receive
some work.

This has the added benefit of doing the flush in the worker thread, outside
of osd_lock.

Signed-off-by: Sage Weil <sage@newdream.net>
src/osd/PG.cc
src/osd/PG.h

index c66b4d121a3e9c8ea8c9451cbd48cc3922674f03..132aaa168440b2a9c87fc539e2156408dd8eaa68 100644 (file)
@@ -1367,9 +1367,8 @@ void PG::activate(ObjectStore::Transaction& t, list<Context*>& tfin,
     update_stats();
   }
 
-  // flush this all out (e.g., deletions from clean_up_local) to avoid
-  // subsequent races.
-  osr.flush();
+  // we need to flush this all out before doing anything else..
+  need_flush = true;
 
   // waiters
   if (!is_replay()) {
@@ -1379,6 +1378,17 @@ void PG::activate(ObjectStore::Transaction& t, list<Context*>& tfin,
   on_activate();
 }
 
+void PG::do_pending_flush()
+{
+  assert(is_locked());
+  if (need_flush) {
+    dout(10) << "do_pending_flush doing pending flush" << dendl;
+    osr.flush();
+    need_flush = false;
+    dout(10) << "do_pending_flush done" << dendl;
+  }
+}
+
 void PG::do_request(OpRequest *op)
 {
   // do any pending flush
index 582dab6f5bac708fc8bb0ba67865737416950a6f..a8976991732c19e8453c5e7f43ebe881945fc191 100644 (file)
@@ -558,6 +558,7 @@ protected:
   // primary-only, recovery-only state
   set<int>             might_have_unfound;  // These osds might have objects on them
                                            // which are unfound on the primary
+  bool need_flush;     // need to flush before any new activity
 
   epoch_t last_peering_reset;
 
@@ -1236,6 +1237,7 @@ public:
     role(0),
     state(0),
     need_up_thru(false),
+    need_flush(false),
     last_peering_reset(0),
     backfill_target(-1),
     pg_stats_lock("PG::pg_stats_lock"),
@@ -1293,6 +1295,8 @@ public:
   bool  is_empty() const { return info.last_update == eversion_t(0,0); }
 
   // pg on-disk state
+  void do_pending_flush();
+
   void write_info(ObjectStore::Transaction& t);
   void write_log(ObjectStore::Transaction& t);