]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
ECBackend: ops must consistently use or not use the cache
authorSamuel Just <sjust@redhat.com>
Thu, 1 Dec 2016 23:33:31 +0000 (15:33 -0800)
committerSamuel Just <sjust@redhat.com>
Fri, 2 Dec 2016 23:56:08 +0000 (15:56 -0800)
If the state is flipped, ops already in the pipeline need to
continue to maintain it.

Signed-off-by: Samuel Just <sjust@redhat.com>
src/osd/ECBackend.cc
src/osd/ECBackend.h

index 9406f931e23e6ba02297326f29a11a37ec3992b4..a29e2a3a84cf6fd9e2cc229166f53c8eddbda55a 100644 (file)
@@ -1746,12 +1746,15 @@ bool ECBackend::try_state_to_reads()
     dout(20) << __func__ << ": invalidating cache after this op"
             << dendl;
     pipeline_state.invalidate();
+    op->using_cache = false;
+  } else {
+    op->using_cache = pipeline_state.caching_enabled();
   }
 
   waiting_state.pop_front();
   waiting_reads.push_back(*op);
 
-  if (op->requires_rmw() || pipeline_state.caching_enabled()) {
+  if (op->using_cache) {
     cache.open_write_pin(op->pin);
 
     extent_set empty;
@@ -1813,7 +1816,7 @@ bool ECBackend::try_reads_to_commit()
     op->hoid,
     op->delta_stats);
 
-  if (pipeline_state.caching_enabled() || op->requires_rmw()) {
+  if (op->using_cache) {
     for (auto &&hpair: op->pending_read) {
       op->remote_read_result[hpair.first].insert(
        cache.get_remaining_extents_for_rmw(
@@ -1872,7 +1875,7 @@ bool ECBackend::try_reads_to_commit()
   dout(20) << __func__ << ": written_set: " << written_set << dendl;
   assert(written_set == op->plan.will_write);
 
-  if (pipeline_state.caching_enabled() || op->requires_rmw()) {
+  if (op->using_cache) {
     for (auto &&hpair: written) {
       dout(20) << __func__ << ": " << hpair << dendl;
       cache.present_rmw_update(hpair.first, op->pin, hpair.second);
@@ -1972,7 +1975,7 @@ bool ECBackend::try_finish_rmw()
     }
   }
 
-  if (pipeline_state.caching_enabled() || op->requires_rmw()) {
+  if (op->using_cache) {
     cache.release_write_pin(op->pin);
   }
   tid_to_op_map.erase(op->tid);
index 3689d118789e42bd9bcbea9cad14337d86c4b510..35b7f8a6d620cc79d86f452fdcef17e03ee84c11 100644 (file)
@@ -440,6 +440,9 @@ public:
     bool requires_rmw() const { return !plan.to_read.empty(); }
     bool invalidates_cache() const { return plan.invalidates_cache; }
 
+    // must be true if requires_rmw(), must be false if invalidates_cache()
+    bool using_cache = false;
+
     /// In progress read state;
     hobject_t::bitwisemap<extent_set> pending_read; // subset already being read
     hobject_t::bitwisemap<extent_set> remote_read;  // subset we must read