]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: get rid off duplicate lock acquisition at txc_finish()
authorIgor Fedotov <ifedotov@mirantis.com>
Mon, 17 Apr 2017 12:44:01 +0000 (05:44 -0700)
committerIgor Fedotov <ifedotov@mirantis.com>
Thu, 20 Apr 2017 15:17:03 +0000 (08:17 -0700)
Signed-off-by: Igor Fedotov <ifedotov@mirantis.com>
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index 92afe79c9c0874afd12d29623246408fc9865845..e09dbac3f28b131ff2efa7e02e967aeee631ebb4 100644 (file)
@@ -7583,41 +7583,12 @@ void BlueStore::_txc_finish(TransContext *txc)
   }
 
   OpSequencerRef osr = txc->osr;
-  {
-    std::lock_guard<std::mutex> l(osr->qlock);
-    txc->state = TransContext::STATE_DONE;
-  }
-
-  bool empty = _osr_reap_done(osr.get());
-  if (empty && osr->zombie) {
-    dout(10) << __func__ << " reaping empty zombie osr " << osr << dendl;
-    osr->_unregister();
-  }
-}
-
-void BlueStore::_txc_release_alloc(TransContext *txc)
-{
-  // update allocator with full released set
-  if (!cct->_conf->bluestore_debug_no_reuse_blocks) {
-    dout(10) << __func__ << " " << txc << " " << txc->released << dendl;
-    for (interval_set<uint64_t>::iterator p = txc->released.begin();
-        p != txc->released.end();
-        ++p) {
-      alloc->release(p.get_start(), p.get_len());
-    }
-  }
-
-  txc->allocated.clear();
-  txc->released.clear();
-}
-
-bool BlueStore::_osr_reap_done(OpSequencer *osr)
-{
   CollectionRef c;
   bool empty = false;
   {
     std::lock_guard<std::mutex> l(osr->qlock);
-    dout(20) << __func__ << " osr " << osr << dendl;
+    txc->state = TransContext::STATE_DONE;
+
     while (!osr->q.empty()) {
       TransContext *txc = &osr->q.front();
       dout(20) << __func__ << "  txc " << txc << " " << txc->get_state_name()
@@ -7650,12 +7621,31 @@ bool BlueStore::_osr_reap_done(OpSequencer *osr)
       empty = true;
     }
   }
-
   if (c) {
     c->trim_cache();
   }
 
-  return empty;
+
+  if (empty && osr->zombie) {
+    dout(10) << __func__ << " reaping empty zombie osr " << osr << dendl;
+    osr->_unregister();
+  }
+}
+
+void BlueStore::_txc_release_alloc(TransContext *txc)
+{
+  // update allocator with full released set
+  if (!cct->_conf->bluestore_debug_no_reuse_blocks) {
+    dout(10) << __func__ << " " << txc << " " << txc->released << dendl;
+    for (interval_set<uint64_t>::iterator p = txc->released.begin();
+        p != txc->released.end();
+        ++p) {
+      alloc->release(p.get_start(), p.get_len());
+    }
+  }
+
+  txc->allocated.clear();
+  txc->released.clear();
 }
 
 void BlueStore::_osr_drain_preceding(TransContext *txc)
index 0f79784f061e1758db95156b0d06203dddc1d149..8cacc6f7aac627a11499f83d1bcd2818e5f1cfb3 100644 (file)
@@ -1601,7 +1601,7 @@ public:
     void discard() override {
       // Note that we may have txc's in flight when the parent Sequencer
       // goes away.  Reflect this with zombie==registered==true and let
-      // _osr_reap_done or _osr_drain_all clean up later.
+      // _osr_drain_all clean up later.
       assert(!zombie);
       zombie = true;
       parent = nullptr;
@@ -1915,7 +1915,6 @@ private:
   void _txc_finish(TransContext *txc);
   void _txc_release_alloc(TransContext *txc);
 
-  bool _osr_reap_done(OpSequencer *osr);
   void _osr_drain_preceding(TransContext *txc);
   void _osr_drain_all();
   void _osr_unregister_all();