From e5f62fb8ac8a1ef79aa97361e83c796b0d94fc28 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 13 Oct 2017 08:40:03 -0500 Subject: [PATCH] osd/PG: move debug_verify_cached_snaps check into PGPool::update Signed-off-by: Sage Weil --- src/osd/PG.cc | 30 +++++++++++++++--------------- src/osd/PG.h | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 596e320f3cb85..38f9a3c612fc1 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -224,7 +224,7 @@ void PG::dump_live_ids() #endif -void PGPool::update(OSDMapRef map) +void PGPool::update(CephContext *cct, OSDMapRef map) { const pg_pool_t *pi = map->get_pg_pool(id); assert(pi); @@ -273,6 +273,19 @@ void PGPool::update(OSDMapRef map) << " snapc " << snapc << (updated ? " (updated)":" (no change)") << dendl; + if (cct->_conf->osd_debug_verify_cached_snaps) { + interval_set actual_removed_snaps; + pi->build_removed_snaps(actual_removed_snaps); + if (!(actual_removed_snaps == cached_removed_snaps)) { + lgeneric_derr(cct) << __func__ + << ": mismatch between the actual removed snaps " + << actual_removed_snaps + << " and pool.cached_removed_snaps " + << " pool.cached_removed_snaps " << cached_removed_snaps + << dendl; + } + assert(actual_removed_snaps == cached_removed_snaps); + } } PG::PG(OSDService *o, OSDMapRef curmap, @@ -5912,20 +5925,7 @@ void PG::handle_advance_map( << " -- " << up_primary << "/" << acting_primary << dendl; update_osdmap_ref(osdmap); - pool.update(osdmap); - if (cct->_conf->osd_debug_verify_cached_snaps) { - interval_set actual_removed_snaps; - const pg_pool_t *pi = osdmap->get_pg_pool(info.pgid.pool()); - assert(pi); - pi->build_removed_snaps(actual_removed_snaps); - if (!(actual_removed_snaps == pool.cached_removed_snaps)) { - derr << __func__ << ": mismatch between the actual removed snaps " - << actual_removed_snaps << " and pool.cached_removed_snaps " - << " pool.cached_removed_snaps " << pool.cached_removed_snaps - << dendl; - } - assert(actual_removed_snaps == pool.cached_removed_snaps); - } + pool.update(cct, osdmap); AdvMap evt( osdmap, lastmap, newup, up_primary, newacting, acting_primary); diff --git a/src/osd/PG.h b/src/osd/PG.h index ffaa361889a30..1e495da50b30f 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -237,7 +237,7 @@ struct PGPool { pi->build_removed_snaps(cached_removed_snaps); } - void update(OSDMapRef map); + void update(CephContext *cct, OSDMapRef map); }; /** PG - Replica Placement Group -- 2.39.5