if (!pgs.size() || !(newflags & (OFR_BACKFILL | OFR_RECOVERY))) {
return;
}
+ set<spg_t> did;
if (newflags & OFR_BACKFILL) {
for (auto& pg : pgs) {
- pg->set_force_backfill(!(newflags & OFR_CANCEL));
+ if (pg->set_force_backfill(!(newflags & OFR_CANCEL))) {
+ did.insert(pg->pg_id);
+ }
}
} else if (newflags & OFR_RECOVERY) {
for (auto& pg : pgs) {
- pg->set_force_recovery(!(newflags & OFR_CANCEL));
+ if (pg->set_force_recovery(!(newflags & OFR_CANCEL))) {
+ did.insert(pg->pg_id);
+ }
}
}
+ if (did.empty()) {
+ dout(10) << __func__ << " " << ((newflags & OFR_CANCEL) ? "cleared" : "set")
+ << " force_" << ((newflags & OFR_BACKFILL) ? "backfill" : "recovery")
+ << " on no pgs" << dendl;
+ } else {
+ dout(10) << __func__ << " " << ((newflags & OFR_CANCEL) ? "cleared" : "set")
+ << " force_" << ((newflags & OFR_BACKFILL) ? "backfill" : "recovery")
+ << " on " << did << dendl;
+ }
}
void OSD::do_recovery(
kick_snap_trim();
}
-void PG::set_force_recovery(bool b)
+bool PG::set_force_recovery(bool b)
{
+ bool did = false;
lock();
if (!deleting) {
if (b) {
dout(20) << __func__ << " set" << dendl;
state_set(PG_STATE_FORCED_RECOVERY);
publish_stats_to_osd();
+ did = true;
}
} else if (state & PG_STATE_FORCED_RECOVERY) {
dout(20) << __func__ << " clear" << dendl;
state_clear(PG_STATE_FORCED_RECOVERY);
publish_stats_to_osd();
+ did = true;
}
}
unlock();
+ return did;
}
-void PG::set_force_backfill(bool b)
+bool PG::set_force_backfill(bool b)
{
+ bool did = false;
lock();
if (!deleting) {
if (b) {
dout(10) << __func__ << " set" << dendl;
state_set(PG_STATE_FORCED_RECOVERY);
publish_stats_to_osd();
+ did = true;
}
} else if (state & PG_STATE_FORCED_RECOVERY) {
dout(10) << __func__ << " clear" << dendl;
state_clear(PG_STATE_FORCED_RECOVERY);
publish_stats_to_osd();
+ did = true;
}
}
unlock();
+ return did;
}
inline int PG::clamp_recovery_priority(int priority)
bool is_forced_recovery_or_backfill() const {
return get_state() & (PG_STATE_FORCED_RECOVERY | PG_STATE_FORCED_BACKFILL);
}
- void set_force_recovery(bool b);
- void set_force_backfill(bool b);
+ bool set_force_recovery(bool b);
+ bool set_force_backfill(bool b);
void queue_peering_event(CephPeeringEvtRef evt);
void process_peering_event(RecoveryCtx *rctx);