From 27ad74b9efe17ec90864aa32d07ae047bad9f366 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 11 Jan 2013 09:03:07 -0800 Subject: osd: use helpers to queue a PG in the scrub LRU Move the duplicated reach into info.history.last_scrub_stamp into a helper so we can control when we queue the PG for scrub. Signed-off-by: Sage Weil --- src/osd/OSD.cc | 4 ++-- src/osd/PG.cc | 32 ++++++++++++++++++++------------ src/osd/PG.h | 3 +++ 3 files changed, 25 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index f57f2264f74..f2801534c25 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -1323,7 +1323,7 @@ void OSD::load_pgs() // read pg state, log pg->read_state(store); - reg_last_pg_scrub(pg->info.pgid, pg->info.history.last_scrub_stamp); + pg->reg_scrub(); // generate state for current mapping osdmap->pg_to_up_acting_osds(pgid, pg->up, pg->acting); @@ -5126,7 +5126,7 @@ void OSD::_remove_pg(PG *pg) // remove from map pg_map.erase(pgid); pg->put(); // since we've taken it out of map - unreg_last_pg_scrub(pg->info.pgid, pg->info.history.last_scrub_stamp); + pg->unreg_scrub(); _put_pool(pg->pool); diff --git a/src/osd/PG.cc b/src/osd/PG.cc index c38ab0c5fa2..28293b3c1e3 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -263,10 +263,10 @@ bool PG::proc_replica_info(int from, pg_info_t &oinfo) peer_info[from] = oinfo; might_have_unfound.insert(from); - osd->unreg_last_pg_scrub(info.pgid, info.history.last_scrub_stamp); + unreg_scrub(); if (info.history.merge(oinfo.history)) dirty_info = true; - osd->reg_last_pg_scrub(info.pgid, info.history.last_scrub_stamp); + reg_scrub(); // stray? if (!is_acting(from)) { @@ -1918,7 +1918,7 @@ void PG::init(int role, vector& newup, vector& newacting, pg_history_t info.stats.acting = acting; info.stats.mapping_epoch = info.history.same_interval_since; - osd->reg_last_pg_scrub(info.pgid, info.history.last_scrub_stamp); + reg_scrub(); write_info(*t); write_log(*t); @@ -2618,6 +2618,16 @@ bool PG::sched_scrub() return ret; } +void PG::reg_scrub() +{ + scrub_reg_stamp = info.history.last_scrub_stamp; + osd->reg_last_pg_scrub(info.pgid, scrub_reg_stamp); +} + +void PG::unreg_scrub() +{ + osd->unreg_last_pg_scrub(info.pgid, scrub_reg_stamp); +} void PG::sub_op_scrub_map(OpRequestRef op) { @@ -3410,10 +3420,10 @@ void PG::scrub_finalize() { state_clear(PG_STATE_INCONSISTENT); // finish up - osd->unreg_last_pg_scrub(info.pgid, info.history.last_scrub_stamp); + unreg_scrub(); info.history.last_scrub = info.last_update; info.history.last_scrub_stamp = ceph_clock_now(g_ceph_context); - osd->reg_last_pg_scrub(info.pgid, info.history.last_scrub_stamp); + reg_scrub(); { ObjectStore::Transaction *t = new ObjectStore::Transaction; @@ -3721,7 +3731,7 @@ void PG::start_peering_interval(const OSDMapRef lastmap, dout(10) << *this << " canceling deletion!" << dendl; deleting = false; osd->remove_wq.dequeue(this); - osd->reg_last_pg_scrub(info.pgid, info.history.last_scrub_stamp); + reg_scrub(); } if (role != oldrole) { @@ -3796,10 +3806,10 @@ void PG::proc_primary_info(ObjectStore::Transaction &t, const pg_info_t &oinfo) dirty_info = true; } - osd->unreg_last_pg_scrub(info.pgid, info.history.last_scrub_stamp); + unreg_scrub(); if (info.history.merge(oinfo.history)) dirty_info = true; - osd->reg_last_pg_scrub(info.pgid, info.history.last_scrub_stamp); + reg_scrub(); // Handle changes to purged_snaps ONLY IF we have caught up if (last_complete_ondisk.epoch >= info.history.last_epoch_started) { @@ -4503,11 +4513,9 @@ boost::statechart::result PG::RecoveryState::Stray::react(const MLogRec& logevt) if (msg->info.last_backfill == hobject_t()) { // restart backfill - pg->osd->unreg_last_pg_scrub(pg->info.pgid, - pg->info.history.last_scrub_stamp); + pg->unreg_scrub(); pg->info = msg->info; - pg->osd->reg_last_pg_scrub(pg->info.pgid, - pg->info.history.last_scrub_stamp); + pg->reg_scrub(); pg->log.claim_log(msg->log); pg->missing.clear(); } else { diff --git a/src/osd/PG.h b/src/osd/PG.h index d6dc5912c23..3c4353dab51 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -747,6 +747,7 @@ public: epoch_t scrub_epoch_start; ScrubMap primary_scrubmap; MOSDRepScrub *active_rep_scrub; + utime_t scrub_reg_stamp; void repair_object(const hobject_t& soid, ScrubMap::object *po, int bad_peer, int ok_peer); bool _compare_scrub_objects(ScrubMap::object &auth, @@ -783,6 +784,8 @@ public: void scrub_unreserve_replicas(); bool scrub_all_replicas_reserved() const; bool sched_scrub(); + void reg_scrub(); + void unreg_scrub(); void replica_scrub(class MOSDRepScrub *op); void sub_op_scrub_map(OpRequestRef op); -- cgit v1.2.1