]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os/bluestore: fix has_aios -> has_pending_aios
authorSage Weil <sage@redhat.com>
Tue, 4 Oct 2016 19:28:31 +0000 (15:28 -0400)
committerSage Weil <sage@redhat.com>
Tue, 4 Oct 2016 19:28:49 +0000 (15:28 -0400)
This is only called from safe callers (with exclusive access),
so we don't need a lock.

It also should only return true for *pending* aios--not aios
we've already submitted!

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

index f3ba54af4fbfebf7915d63547370dddf9b24d647..305d86f1d79b29ae6ef98505bd5bf37eee5d6c21 100644 (file)
@@ -52,9 +52,8 @@ struct IOContext {
   IOContext(const IOContext& other);
   IOContext &operator=(const IOContext& other);
 
-  bool has_aios() {
-    std::lock_guard<std::mutex> l(lock);
-    return num_pending.load() || num_running.load();
+  bool has_pending_aios() {
+    return num_pending.load();
   }
 
   void aio_wait();
index 2d84c1e80fd36d90856b371c1e735ae740a5e3bb..4dc02d662b86182cd8b4aa5cf3aef8f65f3852ba 100644 (file)
@@ -1544,7 +1544,7 @@ int BlueFS::_flush_range(FileWriter *h, uint64_t offset, uint64_t length)
   for (unsigned i = 0; i < MAX_BDEV; ++i) {
     if (bdev[i]) {
       assert(h->iocv[i]);
-      if (h->iocv[i]->has_aios()) {
+      if (h->iocv[i]->has_pending_aios()) {
         bdev[i]->aio_submit(h->iocv[i]);
       }
     }
index 92ce9f5d905b89189397e4b39edb4b8a818d33af..29d240df09c183ff68e1d0ce583c1ca6a00df272 100644 (file)
@@ -5887,7 +5887,7 @@ void BlueStore::_txc_state_proc(TransContext *txc)
     switch (txc->state) {
     case TransContext::STATE_PREPARE:
       txc->log_state_latency(logger, l_bluestore_state_prepare_lat);
-      if (txc->ioc.has_aios()) {
+      if (txc->ioc.has_pending_aios()) {
        txc->state = TransContext::STATE_AIO_WAIT;
        _txc_aio_submit(txc);
        return;
@@ -5946,7 +5946,7 @@ void BlueStore::_txc_state_proc(TransContext *txc)
 
     case TransContext::STATE_WAL_APPLYING:
       txc->log_state_latency(logger, l_bluestore_state_wal_applying_lat);
-      if (txc->ioc.has_aios()) {
+      if (txc->ioc.has_pending_aios()) {
        txc->state = TransContext::STATE_WAL_AIO_WAIT;
        _txc_aio_submit(txc);
        return;