From a007b29859ed947c11facc54c24b89a41c3008e2 Mon Sep 17 00:00:00 2001 From: Ronen Friedman Date: Thu, 13 Jan 2022 09:22:11 +0000 Subject: [PATCH] osd/scrub: change missing_digest fix-list type ...allowing for efficient creation and, more important, direct consumption by the function performing the actual I/O. Signed-off-by: Ronen Friedman --- src/osd/scrubber/PrimaryLogScrub.cc | 7 ++++--- src/osd/scrubber/scrub_backend.cc | 15 +++++---------- src/osd/scrubber/scrub_backend.h | 2 +- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/osd/scrubber/PrimaryLogScrub.cc b/src/osd/scrubber/PrimaryLogScrub.cc index 53247cae4c5a2..127f9fab56bd9 100644 --- a/src/osd/scrubber/PrimaryLogScrub.cc +++ b/src/osd/scrubber/PrimaryLogScrub.cc @@ -42,12 +42,12 @@ bool PrimaryLogScrub::get_store_errors(const scrub_ls_arg_t& arg, return true; } -// forwarders used by the scrubber backend - /// \todo combine the multiple transactions into a single one void PrimaryLogScrub::submit_digest_fixes(const digests_fixes_t& fixes) { - num_digest_updates_pending += fixes.size(); + // note: the following line was modified from '+=' to '=', as we should not + // encounter previous-chunk digest updates after starting a new chunk + num_digest_updates_pending = fixes.size(); dout(10) << __func__ << ": num_digest_updates_pending: " << num_digest_updates_pending << dendl; @@ -99,6 +99,7 @@ void PrimaryLogScrub::submit_digest_fixes(const digests_fixes_t& fixes) } } +// a forwarder used by the scrubber backend void PrimaryLogScrub::add_to_stats(const object_stat_sum_t& stat) { diff --git a/src/osd/scrubber/scrub_backend.cc b/src/osd/scrubber/scrub_backend.cc index af7febf0eec5b..49c6f725bb0af 100644 --- a/src/osd/scrubber/scrub_backend.cc +++ b/src/osd/scrubber/scrub_backend.cc @@ -968,7 +968,8 @@ void ScrubBackend::inconsistents(const hobject_t& ho, if (auth_object.omap_digest_present) { omap_digest = auth_object.omap_digest; } - this_chunk->missing_digest[ho] = make_pair(data_digest, omap_digest); + this_chunk->missing_digest.push_back( + make_pair(ho, make_pair(data_digest, omap_digest))); } if (!this_chunk->cur_inconsistent.empty() || @@ -1017,7 +1018,8 @@ void ScrubBackend::inconsistents(const hobject_t& ho, dout(20) << __func__ << ": will update omap digest on " << ho << dendl; } - this_chunk->missing_digest[ho] = make_pair(data_digest, omap_digest); + this_chunk->missing_digest.push_back( + make_pair(ho, make_pair(data_digest, omap_digest))); break; } } @@ -1739,14 +1741,7 @@ void ScrubBackend::scrub_snapshot_metadata(ScrubMap& map) m_scrubber.m_store->add_snap_error(pool.id, head_error); // fix data/omap digests - digests_fixes_t digest_fixes{this_chunk->missing_digest.size()}; - std::transform( - this_chunk->missing_digest.begin(), - this_chunk->missing_digest.end(), - digest_fixes.begin(), - [](const auto& p) { return std::make_pair(p.first, p.second); }); - - m_scrubber.submit_digest_fixes(digest_fixes); + m_scrubber.submit_digest_fixes(this_chunk->missing_digest); dout(10) << __func__ << " (" << m_mode_desc << ") finish" << dendl; } diff --git a/src/osd/scrubber/scrub_backend.h b/src/osd/scrubber/scrub_backend.h index c866153fb5565..cb23ad09bff76 100644 --- a/src/osd/scrubber/scrub_backend.h +++ b/src/osd/scrubber/scrub_backend.h @@ -171,7 +171,7 @@ struct scrub_chunk_t { utime_t started{ceph_clock_now()}; - std::map missing_digest; + digests_fixes_t missing_digest; /// Map from object with errors to good peers std::map> authoritative; -- 2.39.5