]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: make flush() only wait for kv commit
authorSage Weil <sage@redhat.com>
Wed, 8 Mar 2017 19:48:12 +0000 (14:48 -0500)
committerSage Weil <sage@redhat.com>
Tue, 21 Mar 2017 18:56:27 +0000 (13:56 -0500)
The only remaining flush() users only need to see previous txc's applied
to the kv db (e.g., _omap_clear needs to see the records to delete them).

Signed-off-by: Sage Weil <sage@redhat.com>
# Conflicts:
# src/os/bluestore/BlueStore.h

src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index 3bc22778429b79ae0d92af00cb2bf4a1ab84d48e..af1b51b8a0a99d5e8d6c44b413611ca7e7f06853 100644 (file)
@@ -7341,6 +7341,21 @@ void BlueStore::_txc_finish_kv(TransContext *txc)
 {
   dout(20) << __func__ << " txc " << txc << dendl;
 
+  for (auto ls : { &txc->onodes, &txc->modified_objects }) {
+    for (auto& o : *ls) {
+      std::lock_guard<std::mutex> l(o->flush_lock);
+      dout(20) << __func__ << " onode " << o << " had " << o->flush_txns
+              << dendl;
+      assert(o->flush_txns.count(txc));
+      o->flush_txns.erase(txc);
+      o->flushing_count--;
+      if (o->flush_txns.empty()) {
+       o->flush_cond.notify_all();
+      }
+    }
+    ls->clear();  // clear out refs
+  }
+
   // warning: we're calling onreadable_sync inside the sequencer lock
   if (txc->onreadable_sync) {
     txc->onreadable_sync->complete(0);
@@ -7384,21 +7399,6 @@ void BlueStore::_txc_finish(TransContext *txc)
   }
   txc->shared_blobs_written.clear();
 
-  for (auto ls : { &txc->onodes, &txc->modified_objects }) {
-    for (auto& o : *ls) {
-      std::lock_guard<std::mutex> l(o->flush_lock);
-      dout(20) << __func__ << " onode " << o << " had " << o->flush_txns
-              << dendl;
-      assert(o->flush_txns.count(txc));
-      o->flush_txns.erase(txc);
-      o->flushing_count--;
-      if (o->flush_txns.empty()) {
-       o->flush_cond.notify_all();
-      }
-    }
-    ls->clear();  // clear out refs
-  }
-
   while (!txc->removed_collections.empty()) {
     _queue_reap_collection(txc->removed_collections.front());
     txc->removed_collections.pop_front();
index 19dbd220fe4e8309ce0e8a2c29ceb80ab3772466..d9e0ebd00faef26540d1b50a288a8c9c71283d7f 100644 (file)
@@ -948,10 +948,12 @@ public:
 
     ExtentMap extent_map;
 
+    // track txc's that have not been committed to kv store (and whose
+    // effects cannot be read via the kvdb read methods)
     std::atomic<int> flushing_count = {0};
     std::mutex flush_lock;  ///< protect flush_txns
-    std::condition_variable flush_cond;   ///< wait here for unapplied txns
-    set<TransContext*> flush_txns;   ///< committing or deferred txns
+    std::condition_variable flush_cond;   ///< wait here for uncommitted txns
+    set<TransContext*> flush_txns;        ///< unapplied txns
 
     Onode(Collection *c, const ghobject_t& o,
          const mempool::bluestore_meta_other::string& k)