From e2552110af7f82198dd9f4633eb20395335bc008 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 19 Apr 2019 13:56:25 -0500 Subject: [PATCH] osd/osd_types: add pg_history_t ctor that takes creation epoch+stamp Signed-off-by: Sage Weil --- src/osd/OSD.cc | 21 ++------------------- src/osd/osd_types.h | 42 +++++++++++++++++++++--------------------- 2 files changed, 23 insertions(+), 40 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 750b94abbb2..d5f6f0872cd 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -4705,14 +4705,7 @@ void OSD::build_initial_pg_history( PastIntervals *pi) { dout(10) << __func__ << " " << pgid << " created " << created << dendl; - h->epoch_created = created; - h->epoch_pool_created = created; - h->same_interval_since = created; - h->same_up_since = created; - h->same_primary_since = created; - h->last_scrub_stamp = created_stamp; - h->last_deep_scrub_stamp = created_stamp; - h->last_clean_scrub_stamp = created_stamp; + *h = pg_history_t(created, created_stamp); OSDMapRef lastmap = service.get_map(created); int up_primary, acting_primary; @@ -9272,16 +9265,6 @@ void OSD::handle_fast_pg_create(MOSDPGCreate2 *m) utime_t created_stamp = p.second.second; dout(20) << __func__ << " " << pgid << " e" << created << "@" << created_stamp << dendl; - pg_history_t h; - h.epoch_created = created; - h.epoch_pool_created = created; - h.same_up_since = created; - h.same_interval_since = created; - h.same_primary_since = created; - h.last_scrub_stamp = created_stamp; - h.last_deep_scrub_stamp = created_stamp; - h.last_clean_scrub_stamp = created_stamp; - enqueue_peering_evt( pgid, PGPeeringEventRef( @@ -9293,7 +9276,7 @@ void OSD::handle_fast_pg_create(MOSDPGCreate2 *m) new PGCreateInfo( pgid, created, - h, + pg_history_t(created, created_stamp), PastIntervals(), true) ))); diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 1d59a85fd9d..78cf6e8592d 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -2571,16 +2571,16 @@ WRITE_CLASS_ENCODER(pg_hit_set_history_t) * history they need to worry about. */ struct pg_history_t { - epoch_t epoch_created; // epoch in which *pg* was created (pool or pg) - epoch_t epoch_pool_created; // epoch in which *pool* was created + epoch_t epoch_created = 0; // epoch in which *pg* was created (pool or pg) + epoch_t epoch_pool_created = 0; // epoch in which *pool* was created // (note: may be pg creation epoch for // pre-luminous clusters) - epoch_t last_epoch_started; // lower bound on last epoch started (anywhere, not necessarily locally) - epoch_t last_interval_started; // first epoch of last_epoch_started interval - epoch_t last_epoch_clean; // lower bound on last epoch the PG was completely clean. - epoch_t last_interval_clean; // first epoch of last_epoch_clean interval - epoch_t last_epoch_split; // as parent or child - epoch_t last_epoch_marked_full; // pool or cluster + epoch_t last_epoch_started = 0;; // lower bound on last epoch started (anywhere, not necessarily locally) + epoch_t last_interval_started = 0;; // first epoch of last_epoch_started interval + epoch_t last_epoch_clean = 0;; // lower bound on last epoch the PG was completely clean. + epoch_t last_interval_clean = 0;; // first epoch of last_epoch_clean interval + epoch_t last_epoch_split = 0;; // as parent or child + epoch_t last_epoch_marked_full = 0;; // pool or cluster /** * In the event of a map discontinuity, same_*_since may reflect the first @@ -2589,9 +2589,9 @@ struct pg_history_t { * must have been a clean interval between e and now and that we cannot be * in the active set during the interval containing e. */ - epoch_t same_up_since; // same acting set since - epoch_t same_interval_since; // same acting AND up set since - epoch_t same_primary_since; // same primary at least back through this epoch. + epoch_t same_up_since = 0;; // same acting set since + epoch_t same_interval_since = 0;; // same acting AND up set since + epoch_t same_primary_since = 0;; // same primary at least back through this epoch. eversion_t last_scrub; eversion_t last_deep_scrub; @@ -2619,16 +2619,16 @@ struct pg_history_t { l.last_clean_scrub_stamp == r.last_clean_scrub_stamp; } - pg_history_t() - : epoch_created(0), - epoch_pool_created(0), - last_epoch_started(0), - last_interval_started(0), - last_epoch_clean(0), - last_interval_clean(0), - last_epoch_split(0), - last_epoch_marked_full(0), - same_up_since(0), same_interval_since(0), same_primary_since(0) {} + pg_history_t() {} + pg_history_t(epoch_t created, utime_t stamp) + : epoch_created(created), + epoch_pool_created(created), + same_up_since(created), + same_interval_since(created), + same_primary_since(created), + last_scrub_stamp(stamp), + last_deep_scrub_stamp(stamp), + last_clean_scrub_stamp(stamp) {} bool merge(const pg_history_t &other) { // Here, we only update the fields which cannot be calculated from the OSDmap. -- 2.39.5