]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: avoid unnecessary notify. 29345/head
authorJianpeng Ma <jianpeng.ma@intel.com>
Mon, 22 Jul 2019 14:02:41 +0000 (22:02 +0800)
committerJianpeng Ma <jianpeng.ma@intel.com>
Fri, 26 Jul 2019 07:46:29 +0000 (15:46 +0800)
Add parameter count waiting list for Onode::flush to avoid unnecessary
notify.

Signed-off-by: Jianpeng Ma <jianpeng.ma@intel.com>
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index bf1407ba7b1afbac1b2107d6d331820c06cd37fa..e424f8449706ca2c01f9196b016f7edb2e412dc0 100644 (file)
@@ -3287,10 +3287,12 @@ void BlueStore::Onode::flush()
 {
   if (flushing_count.load()) {
     ldout(c->store->cct, 20) << __func__ << " cnt:" << flushing_count << dendl;
+    waiting_count++;
     std::unique_lock l(flush_lock);
     while (flushing_count.load()) {
       flush_cond.wait(l);
     }
+    waiting_count--;
   }
   ldout(c->store->cct, 20) << __func__ << " done" << dendl;
 }
@@ -10201,7 +10203,7 @@ void BlueStore::_txc_applied_kv(TransContext *txc)
     for (auto& o : *ls) {
       dout(20) << __func__ << " onode " << o << " had " << o->flushing_count
               << dendl;
-      if (--o->flushing_count == 0) {
+      if (--o->flushing_count == 0 && o->waiting_count.load()) {
         std::lock_guard l(o->flush_lock);
        o->flush_cond.notify_all();
       }
index c9b26ca731a6c257977d702751766c6b5253d55b..f31470e6860fa8e5f210972a25c0da2217656516 100644 (file)
@@ -1060,6 +1060,7 @@ public:
     // 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::atomic<int> waiting_count = {0};
     /// protect flush_txns
     ceph::mutex flush_lock = ceph::make_mutex("BlueStore::Onode::flush_lock");
     ceph::condition_variable flush_cond;   ///< wait here for uncommitted txns