]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: call onreadable from queue_transaction
authorSage Weil <sage@redhat.com>
Fri, 6 Oct 2017 15:24:02 +0000 (10:24 -0500)
committerSage Weil <sage@redhat.com>
Mon, 11 Dec 2017 21:04:57 +0000 (15:04 -0600)
Bluestore updates are immediately present in the cache and readable.  The
only exception are omap updates, but the read methods there block until
they commit, so we can still tell the OSD that they are readable.

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

index e096b0075b0f39285a37e93eb3e7f51223f7e147..205bd00abf1397d6ee9faafbf73c6314ff19b1c0 100644 (file)
@@ -8217,21 +8217,12 @@ void BlueStore::_txc_committed_kv(TransContext *txc)
 {
   dout(20) << __func__ << " txc " << txc << dendl;
 
-  // warning: we're calling onreadable_sync inside the sequencer lock
-  if (txc->onreadable_sync) {
-    txc->onreadable_sync->complete(0);
-    txc->onreadable_sync = NULL;
-  }
   unsigned n = txc->osr->parent->shard_hint.hash_to_shard(m_finisher_num);
   if (txc->oncommit) {
     logger->tinc(l_bluestore_commit_lat, ceph_clock_now() - txc->start);
     finishers[n]->queue(txc->oncommit);
     txc->oncommit = NULL;
   }
-  if (txc->onreadable) {
-    finishers[n]->queue(txc->onreadable);
-    txc->onreadable = NULL;
-  }
 
   if (!txc->oncommits.empty()) {
     finishers[n]->queue(txc->oncommits);
@@ -9036,8 +9027,6 @@ int BlueStore::queue_transactions(
 
   // prepare
   TransContext *txc = _txc_create(osr);
-  txc->onreadable = onreadable;
-  txc->onreadable_sync = onreadable_sync;
   txc->oncommit = ondisk;
 
   for (vector<Transaction>::iterator p = tls.begin(); p != tls.end(); ++p) {
@@ -9091,6 +9080,19 @@ int BlueStore::queue_transactions(
   // execute (start)
   _txc_state_proc(txc);
 
+  // we're immediately readable (unlike FileStore)
+  if (onreadable_sync) {
+    onreadable_sync->complete(0);
+  }
+  if (onreadable) {
+    // NOTE: these may complete out of order since some may be sync and some
+    // may be async.
+    if (!onreadable->sync_complete(0)) {
+      unsigned n = osr->parent->shard_hint.hash_to_shard(m_finisher_num);
+      finishers[n]->queue(onreadable);
+    }
+  }
+
   logger->tinc(l_bluestore_submit_lat, ceph_clock_now() - start);
   logger->tinc(l_bluestore_throttle_lat, tend - tstart);
   return 0;
index f76308d8c422e3e9749f2ef037a0095d4342140e..b2ecb0f4453819f10dd499d387e472389d139159 100644 (file)
@@ -1553,8 +1553,6 @@ public:
 
     KeyValueDB::Transaction t; ///< then we will commit this
     Context *oncommit = nullptr;         ///< signal on commit
-    Context *onreadable = nullptr;       ///< signal on readable
-    Context *onreadable_sync = nullptr;  ///< signal on readable
     list<Context*> oncommits;  ///< more commit completions
     list<CollectionRef> removed_collections; ///< colls we removed