From: Sage Weil Date: Thu, 23 Oct 2014 23:52:22 +0000 (-0700) Subject: osd/ReplicatedPG: factor out must_promote case from all cache modes X-Git-Tag: v0.92~33^2~15 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5361bc043fc6c054c3f88581b4285b5da9feb933;p=ceph.git osd/ReplicatedPG: factor out must_promote case from all cache modes Signed-off-by: Sage Weil --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 27180c6bec28..475555322d0a 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -1769,6 +1769,11 @@ bool ReplicatedPG::maybe_handle_cache(OpRequestRef op, MOSDOp *m = static_cast(op->get_req()); const object_locator_t& oloc = m->get_object_locator(); + if (must_promote) { + promote_object(obc, missing_oid, oloc, op); + return true; + } + switch (pool.info.cache_mode) { case pg_pool_t::CACHEMODE_NONE: return false; @@ -1785,10 +1790,10 @@ bool ReplicatedPG::maybe_handle_cache(OpRequestRef op, waiting_for_cache_not_full.push_back(op); return true; } - if (!must_promote && can_skip_promote(op, obc)) { + if (can_skip_promote(op, obc)) { return false; } - if (op->may_write() || write_ordered || must_promote || !hit_set) { + if (op->may_write() || write_ordered || !hit_set) { promote_object(obc, missing_oid, oloc, op); } else { switch (pool.info.min_read_recency_for_promote) { @@ -1828,10 +1833,7 @@ bool ReplicatedPG::maybe_handle_cache(OpRequestRef op, return true; case pg_pool_t::CACHEMODE_FORWARD: - if (must_promote) - promote_object(obc, missing_oid, oloc, op); - else - do_cache_redirect(op, obc); + do_cache_redirect(op, obc); return true; case pg_pool_t::CACHEMODE_READONLY: @@ -1857,7 +1859,7 @@ bool ReplicatedPG::maybe_handle_cache(OpRequestRef op, waiting_for_cache_not_full.push_back(op); return true; } - if (!must_promote && can_skip_promote(op, obc)) { + if (can_skip_promote(op, obc)) { return false; } promote_object(obc, missing_oid, oloc, op); @@ -1865,10 +1867,7 @@ bool ReplicatedPG::maybe_handle_cache(OpRequestRef op, } // If it is a read, we can read, we need to forward it - if (must_promote) - promote_object(obc, missing_oid, oloc, op); - else - do_cache_redirect(op, obc); + do_cache_redirect(op, obc); return true; default: