From: Samuel Just Date: Thu, 1 Dec 2016 23:33:31 +0000 (-0800) Subject: ECBackend: ops must consistently use or not use the cache X-Git-Tag: v11.1.0~58^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=77506161393d9ad5b43dba5f447ded9c28dfd5c4;p=ceph.git ECBackend: ops must consistently use or not use the cache If the state is flipped, ops already in the pipeline need to continue to maintain it. Signed-off-by: Samuel Just --- diff --git a/src/osd/ECBackend.cc b/src/osd/ECBackend.cc index 9406f931e23e6..a29e2a3a84cf6 100644 --- a/src/osd/ECBackend.cc +++ b/src/osd/ECBackend.cc @@ -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); diff --git a/src/osd/ECBackend.h b/src/osd/ECBackend.h index 3689d118789e4..35b7f8a6d620c 100644 --- a/src/osd/ECBackend.h +++ b/src/osd/ECBackend.h @@ -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 pending_read; // subset already being read hobject_t::bitwisemap remote_read; // subset we must read