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)
class PG : public DoutPrefixProvider {
public:
- void set_force_recovery(bool b);
- void set_force_backfill(bool b);
+ bool set_force_recovery(bool b);
+ bool set_force_backfill(bool b);
protected:
OSDService *osd;
PG(OSDService *o, OSDMapRef curmap,
const PGPool &pool, spg_t p);
~PG() override;
+ const spg_t pg_id;
private:
// Prevent copying
explicit PG(const PG& rhs);
PG& operator=(const PG& rhs);
- const spg_t pg_id;
uint64_t peer_features;
uint64_t acting_features;
uint64_t upacting_features;