]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: kill kv_submitted bool; use a new state
authorSage Weil <sage@redhat.com>
Tue, 15 Nov 2016 17:35:10 +0000 (12:35 -0500)
committerSage Weil <sage@redhat.com>
Fri, 18 Nov 2016 01:33:12 +0000 (19:33 -0600)
We have state definitions; use them!

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

index 071bdc6e73c6b1322a3d8009ef104633a8b2e12d..fb2df427ad14d4f15d1491b9bedf9096b6881c17 100644 (file)
@@ -6237,7 +6237,7 @@ void BlueStore::_txc_state_proc(TransContext *txc)
                   << dendl;
        } else {
          _txc_finalize_kv(txc, txc->t);
-         txc->kv_submitted = true;
+         txc->state = TransContext::STATE_KV_SUBMITTED;
          int r = db->submit_transaction(txc->t);
          assert(r == 0);
        }
@@ -6246,13 +6246,13 @@ void BlueStore::_txc_state_proc(TransContext *txc)
        std::lock_guard<std::mutex> l(kv_lock);
        kv_queue.push_back(txc);
        kv_cond.notify_one();
-       if (!txc->kv_submitted) {
+       if (txc->state != TransContext::STATE_KV_SUBMITTED) {
          kv_queue_unsubmitted.push_back(txc);
          ++txc->osr->kv_committing_serially;
        }
       }
       return;
-    case TransContext::STATE_KV_QUEUED:
+    case TransContext::STATE_KV_SUBMITTED:
       txc->log_state_latency(logger, l_bluestore_state_kv_committing_lat);
       txc->state = TransContext::STATE_KV_DONE;
       _txc_finish_kv(txc);
@@ -6638,13 +6638,13 @@ void BlueStore::_kv_sync_thread()
        dout(10) << __func__ << " new_blobid_max " << new_blobid_max << dendl;
       }
       for (auto txc : kv_submitting) {
-       assert(!txc->kv_submitted);
+       assert(txc->state == TransContext::STATE_KV_QUEUED);
        _txc_finalize_kv(txc, txc->t);
        txc->log_state_latency(logger, l_bluestore_state_kv_queued_lat);
        int r = db->submit_transaction(txc->t);
        assert(r == 0);
        --txc->osr->kv_committing_serially;
-       txc->kv_submitted = true;
+       txc->state = TransContext::STATE_KV_SUBMITTED;
       }
       for (auto txc : kv_committing) {
        _txc_release_alloc(txc);
@@ -6699,7 +6699,7 @@ void BlueStore::_kv_sync_thread()
               << " in " << dur << dendl;
       while (!kv_committing.empty()) {
        TransContext *txc = kv_committing.front();
-       assert(txc->kv_submitted);
+       assert(txc->state == TransContext::STATE_KV_SUBMITTED);
        _txc_state_proc(txc);
        kv_committing.pop_front();
       }
index e64618ffe7393306ab9a1ceb7ee523999aa9ad65..5b15b7ae157ad9a7b05261cb4cac44e1cb264d3d 100644 (file)
@@ -1168,7 +1168,8 @@ public:
       STATE_PREPARE,
       STATE_AIO_WAIT,
       STATE_IO_DONE,
-      STATE_KV_QUEUED,
+      STATE_KV_QUEUED,     // queued for kv_sync_thread submission
+      STATE_KV_SUBMITTED,  // submitted to kv; not yet synced
       STATE_KV_DONE,
       STATE_WAL_QUEUED,
       STATE_WAL_APPLYING,
@@ -1187,6 +1188,7 @@ public:
       case STATE_AIO_WAIT: return "aio_wait";
       case STATE_IO_DONE: return "io_done";
       case STATE_KV_QUEUED: return "kv_queued";
+      case STATE_KV_SUBMITTED: return "kv_submitted";
       case STATE_KV_DONE: return "kv_done";
       case STATE_WAL_QUEUED: return "wal_queued";
       case STATE_WAL_APPLYING: return "wal_applying";
@@ -1225,8 +1227,6 @@ public:
     boost::intrusive::list_member_hook<> wal_queue_item;
     bluestore_wal_transaction_t *wal_txn; ///< wal transaction (if any)
 
-    bool kv_submitted = false; ///< true when we've been submitted to kv db
-
     interval_set<uint64_t> allocated, released;
     struct volatile_statfs{
       enum {