From: Samuel Just Date: Tue, 29 Nov 2016 21:56:06 +0000 (-0800) Subject: ReplicatedPG: merge apply_ctx_scrub_stats into apply_stats X-Git-Tag: v11.1.0~59^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0597309ddba3f20bf51b988d4e24f217701f151a;p=ceph.git ReplicatedPG: merge apply_ctx_scrub_stats into apply_stats The only way the two aren't called essentially atomically is when the ECBackend needs to delay a write for rmw. In such a case, we actually want to delay the scrub_cstat application as well since otherwise, we'd have to flush the backend before settling up at the end of scrub. Perhaps this should be a separate function to distinguish between the replica+primary info update and the primary scrub_cstat update, but that seems more complicated than it's really worth. Fixes: http://tracker.ceph.com/issues/17999 Signed-off-by: Samuel Just --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index b69e90349d7a..ee5c9fd0b5e7 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -6775,8 +6775,7 @@ int ReplicatedPG::prepare_transaction(OpContext *ctx) return result; } -void ReplicatedPG::finish_ctx(OpContext *ctx, int log_op_type, bool maintain_ssc, - bool scrub_ok) +void ReplicatedPG::finish_ctx(OpContext *ctx, int log_op_type, bool maintain_ssc) { const hobject_t& soid = ctx->obs->oi.soid; dout(20) << __func__ << " " << soid << " " << ctx @@ -6934,8 +6933,6 @@ void ReplicatedPG::finish_ctx(OpContext *ctx, int log_op_type, bool maintain_ssc ctx->obc->ssc->exists = true; ctx->obc->ssc->snapset = ctx->new_snapset; } - - apply_ctx_scrub_stats(ctx, scrub_ok); } void ReplicatedPG::apply_stats( @@ -6954,16 +6951,11 @@ void ReplicatedPG::apply_stats( else if (cmp(soid, last_backfill_started, get_sort_bitwise()) <= 0) pending_backfill_updates[soid].stats.add(delta_stats); } -} -void ReplicatedPG::apply_ctx_scrub_stats(OpContext *ctx, bool scrub_ok) -{ - const hobject_t& soid = ctx->obs->oi.soid; - if (!scrub_ok && scrubber.active) { - assert(cmp(soid, scrubber.start, get_sort_bitwise()) < 0 || - cmp(soid, scrubber.end, get_sort_bitwise()) >= 0); - if (cmp(soid, scrubber.start, get_sort_bitwise()) < 0) - scrub_cstat.add(ctx->delta_stats); + if (is_primary() && scrubber.active) { + if (cmp(soid, scrubber.start, get_sort_bitwise()) < 0) { + scrub_cstat.add(delta_stats); + } } } @@ -11623,7 +11615,6 @@ void ReplicatedPG::hit_set_remove_all() utime_t now = ceph_clock_now(cct); ctx->mtime = now; hit_set_trim(ctx, 0); - apply_ctx_scrub_stats(ctx.get()); simple_opc_submit(std::move(ctx)); } @@ -11842,7 +11833,6 @@ void ReplicatedPG::hit_set_persist() hit_set_trim(ctx, max); - apply_ctx_scrub_stats(ctx.get()); simple_opc_submit(std::move(ctx)); } @@ -13012,7 +13002,7 @@ void ReplicatedPG::scrub_snapshot_metadata( ctx->mtime = utime_t(); // do not update mtime ctx->new_obs.oi.set_data_digest(p->second.first); ctx->new_obs.oi.set_omap_digest(p->second.second); - finish_ctx(ctx.get(), pg_log_entry_t::MODIFY, true, true); + finish_ctx(ctx.get(), pg_log_entry_t::MODIFY); ctx->register_on_success( [this]() { @@ -13265,7 +13255,6 @@ boost::statechart::result ReplicatedPG::AwaitAsyncWork::react(const DoSnapWork&) pg->snap_trimmer_machine.process_event(RepopsComplete()); }); - pg->apply_ctx_scrub_stats(ctx.get()); pg->simple_opc_submit(std::move(ctx)); } diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index bb9fbf3fdcae..cc2ac7d6fe1f 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -1097,15 +1097,11 @@ protected: const hobject_t& head, const hobject_t& coid, object_info_t *poi); void execute_ctx(OpContext *ctx); - void finish_ctx(OpContext *ctx, int log_op_type, bool maintain_ssc=true, - bool scrub_ok=false); + void finish_ctx(OpContext *ctx, int log_op_type, bool maintain_ssc=true); void reply_ctx(OpContext *ctx, int err); void reply_ctx(OpContext *ctx, int err, eversion_t v, version_t uv); void make_writeable(OpContext *ctx); void log_op_stats(OpContext *ctx); - void apply_ctx_scrub_stats( - OpContext *ctx, - bool scrub_ok=false); ///< true if we should skip scrub stat update void write_update_size_and_usage(object_stat_sum_t& stats, object_info_t& oi, interval_set& modified, uint64_t offset,