From: Sage Weil Date: Sun, 17 Sep 2017 23:29:38 +0000 (-0500) Subject: osd/PG: simplify unfound recovery case; rename method X-Git-Tag: v13.0.1~634^2~24 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e5405feada72dddd146bc5510ebf93a729c3dcae;p=ceph-ci.git osd/PG: simplify unfound recovery case; rename method Signed-off-by: Sage Weil --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 4c21f392d57..8d8c17c8848 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -8850,15 +8850,12 @@ void OSD::do_recovery( dout(10) << "do_recovery started " << started << "/" << reserved_pushes << " on " << *pg << dendl; - // If no recovery op is started, don't bother to manipulate the RecoveryCtx - if (!started && (wip || !pg->have_unfound())) { - goto out; + if (!wip && pg->have_unfound()) { + PG::RecoveryCtx rctx = create_context(); + rctx.handle = &handle; + pg->find_unfound(queued, &rctx); + dispatch_context(rctx, pg, pg->get_osdmap()); } - - PG::RecoveryCtx rctx = create_context(); - rctx.handle = &handle; - pg->stuck_on_unfound(queued, wip, &rctx); - dispatch_context(rctx, pg, pg->get_osdmap()); } out: diff --git a/src/osd/PG.cc b/src/osd/PG.cc index fa5104494ad..955d213c681 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -5734,7 +5734,7 @@ void PG::queue_query(epoch_t msg_epoch, MQuery(from, q, query_epoch)))); } -void PG::stuck_on_unfound(epoch_t queued, bool wip, RecoveryCtx *rctx) +void PG::find_unfound(epoch_t queued, RecoveryCtx *rctx) { /* * if we couldn't start any recovery ops and things are still @@ -5742,34 +5742,32 @@ void PG::stuck_on_unfound(epoch_t queued, bool wip, RecoveryCtx *rctx) * It may be that our initial locations were bad and we errored * out while trying to pull. */ - if (!wip && have_unfound()) { - discover_all_missing(*rctx->query_map); - if (rctx->query_map->empty()) { - string action; - if (state_test(PG_STATE_BACKFILLING)) { - auto evt = PG::CephPeeringEvtRef( - new PG::CephPeeringEvt( - queued, - queued, - PG::DeferBackfill(cct->_conf->osd_recovery_retry_interval))); - queue_peering_event(evt); - action = "in backfill"; - } else if (state_test(PG_STATE_RECOVERING)) { - auto evt = PG::CephPeeringEvtRef( - new PG::CephPeeringEvt( - queued, - queued, - PG::DeferRecovery(cct->_conf->osd_recovery_retry_interval))); - queue_peering_event(evt); - action = "in recovery"; - } else { - action = "already out of recovery/backfill"; - } - dout(10) << __func__ << ": no luck, giving up on this pg for now (" << action << ")" << dendl; + discover_all_missing(*rctx->query_map); + if (rctx->query_map->empty()) { + string action; + if (state_test(PG_STATE_BACKFILLING)) { + auto evt = PG::CephPeeringEvtRef( + new PG::CephPeeringEvt( + queued, + queued, + PG::DeferBackfill(cct->_conf->osd_recovery_retry_interval))); + queue_peering_event(evt); + action = "in backfill"; + } else if (state_test(PG_STATE_RECOVERING)) { + auto evt = PG::CephPeeringEvtRef( + new PG::CephPeeringEvt( + queued, + queued, + PG::DeferRecovery(cct->_conf->osd_recovery_retry_interval))); + queue_peering_event(evt); + action = "in recovery"; } else { - dout(10) << __func__ << ": no luck, giving up on this pg for now (queue_recovery)" << dendl; - queue_recovery(); + action = "already out of recovery/backfill"; } + dout(10) << __func__ << ": no luck, giving up on this pg for now (" << action << ")" << dendl; + } else { + dout(10) << __func__ << ": no luck, giving up on this pg for now (queue_recovery)" << dendl; + queue_recovery(); } } diff --git a/src/osd/PG.h b/src/osd/PG.h index b7bb23ccdef..c9c362ab45b 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -436,7 +436,7 @@ public: uint64_t *ops_begun) = 0; // more work after the above, but with a RecoveryCtx - void stuck_on_unfound(epoch_t queued, bool wip, RecoveryCtx *rctx); + void find_unfound(epoch_t queued, RecoveryCtx *rctx); virtual void get_watchers(std::list *ls) = 0;