From 726894353f5ba01d74870e7917270c7b5a3ce1cc Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Wed, 3 Apr 2019 16:50:14 -0700 Subject: [PATCH] osd/: move more state helpers to PeeringState Signed-off-by: Samuel Just --- src/osd/PG.h | 9 ++++----- src/osd/PeeringState.h | 11 +++++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/osd/PG.h b/src/osd/PG.h index 8a7aa1ed6b4..71283d54b83 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -810,7 +810,7 @@ protected: public: bool is_backfill_targets(pg_shard_t osd) { - return backfill_targets.count(osd); + return recovery_state.is_backfill_targets(osd); } // Space reserved for backfill is primary_num_bytes - local_num_bytes @@ -1406,13 +1406,12 @@ protected: return recovery_state.should_send_notify(); } - int get_state() const { return state; } bool is_active() const { return recovery_state.is_active(); } bool is_activating() const { return recovery_state.is_activating(); } bool is_peering() const { return recovery_state.is_peering(); } bool is_down() const { return recovery_state.is_down(); } - bool is_recovery_unfound() const { return state_test(PG_STATE_RECOVERY_UNFOUND); } - bool is_backfill_unfound() const { return state_test(PG_STATE_BACKFILL_UNFOUND); } + bool is_recovery_unfound() const { return recovery_state.is_recovery_unfound(); } + bool is_backfill_unfound() const { return recovery_state.is_backfill_unfound(); } bool is_incomplete() const { return recovery_state.is_incomplete(); } bool is_clean() const { return recovery_state.is_clean(); } bool is_degraded() const { return recovery_state.is_degraded(); } @@ -1420,7 +1419,7 @@ protected: bool is_scrubbing() const { return state_test(PG_STATE_SCRUBBING); } bool is_remapped() const { return recovery_state.is_remapped(); } bool is_peered() const { return recovery_state.is_peered(); } - bool is_recovering() const { return state_test(PG_STATE_RECOVERING); } + bool is_recovering() const { return recovery_state.is_recovering(); } bool is_premerge() const { return recovery_state.is_premerge(); } bool is_repair() const { return recovery_state.is_repair(); } diff --git a/src/osd/PeeringState.h b/src/osd/PeeringState.h index 3720ec31d72..e7c4adb0557 100644 --- a/src/osd/PeeringState.h +++ b/src/osd/PeeringState.h @@ -1573,6 +1573,10 @@ public: return up_primary.osd; } + bool is_backfill_targets(pg_shard_t osd) { + return backfill_targets.count(osd); + } + bool state_test(uint64_t m) const { return (state & m) != 0; } void state_set(uint64_t m) { state |= m; } void state_clear(uint64_t m) { state &= ~m; } @@ -1585,6 +1589,12 @@ public: bool is_activating() const { return state_test(PG_STATE_ACTIVATING); } bool is_peering() const { return state_test(PG_STATE_PEERING); } bool is_down() const { return state_test(PG_STATE_DOWN); } + bool is_recovery_unfound() const { + return state_test(PG_STATE_RECOVERY_UNFOUND); + } + bool is_backfill_unfound() const { + return state_test(PG_STATE_BACKFILL_UNFOUND); + } bool is_incomplete() const { return state_test(PG_STATE_INCOMPLETE); } bool is_clean() const { return state_test(PG_STATE_CLEAN); } bool is_degraded() const { return state_test(PG_STATE_DEGRADED); } @@ -1593,6 +1603,7 @@ public: bool is_peered() const { return state_test(PG_STATE_ACTIVE) || state_test(PG_STATE_PEERED); } + bool is_recovering() const { return state_test(PG_STATE_RECOVERING); } bool is_premerge() const { return state_test(PG_STATE_PREMERGE); } bool is_repair() const { return state_test(PG_STATE_REPAIR); } bool is_empty() const { return info.last_update == eversion_t(0,0); } -- 2.39.5