From: Samuel Just Date: Fri, 29 Mar 2019 22:56:44 +0000 (-0700) Subject: osd/: remove OSDService::check_osdmap_full, fix caller X-Git-Tag: v15.1.0~2774^2~53 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=33c231e759f82f72fd2f3b7368ba446243516935;p=ceph.git osd/: remove OSDService::check_osdmap_full, fix caller PeeringState was the only remaining caller -- both the interface in PGBackend and the pass-through in PrimaryLogPG were actually unused. Further, the WaitLocalRecoveryReserved user does not appear to actually require the fresh-off-of-the-wire osdmap available from OSDService. As such, moved the logic into OSDMap itself and simply used the PG local osdmap. Note, the above is a change in behavior that probably could use a second opinion. Signed-off-by: Samuel Just --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 14e3fea5767f..8fa0e0796638 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -980,16 +980,6 @@ float OSDService::compute_adjusted_ratio(osd_stat_t new_stat, float *pratio, return ((float)new_stat.statfs.get_used()) / ((float)new_stat.statfs.total); } -bool OSDService::check_osdmap_full(const set &missing_on) -{ - OSDMapRef osdmap = get_osdmap(); - for (auto shard : missing_on) { - if (osdmap->get_state(shard.osd) & CEPH_OSD_FULL) - return true; - } - return false; -} - void OSDService::send_message_osd_cluster(int peer, Message *m, epoch_t from_epoch) { OSDMapRef next_map = get_nextmap_reserved(); diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 9d2a4b5bcb0d..d7f334ebdd6a 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -971,7 +971,6 @@ public: bool is_nearfull() const; bool need_fullness_update(); ///< osdmap state needs update void set_injectfull(s_names type, int64_t count); - bool check_osdmap_full(const set &missing_on); // -- epochs -- diff --git a/src/osd/OSDMap.h b/src/osd/OSDMap.h index 2236dea316a3..d189399afae5 100644 --- a/src/osd/OSDMap.h +++ b/src/osd/OSDMap.h @@ -1401,6 +1401,14 @@ public: pg_upmap_items.count(pg); } + bool check_full(const set &missing_on) const { + for (auto shard : missing_on) { + if (get_state(shard.osd) & CEPH_OSD_FULL) + return true; + } + return false; + } + /* * handy helpers to build simple maps... */ diff --git a/src/osd/PGBackend.h b/src/osd/PGBackend.h index b48cbfb1bd4a..6ea782bd75e1 100644 --- a/src/osd/PGBackend.h +++ b/src/osd/PGBackend.h @@ -294,8 +294,6 @@ typedef std::shared_ptr OSDMapRef; virtual bool check_failsafe_full() = 0; - virtual bool check_osdmap_full(const set &missing_on) = 0; - virtual bool pg_is_repair() = 0; virtual void inc_osd_stat_repaired() = 0; virtual bool pg_is_remote_backfilling() = 0; diff --git a/src/osd/PeeringState.cc b/src/osd/PeeringState.cc index 4d3451f18aab..a546ea0754b2 100644 --- a/src/osd/PeeringState.cc +++ b/src/osd/PeeringState.cc @@ -2147,7 +2147,7 @@ PeeringState::WaitLocalRecoveryReserved::WaitLocalRecoveryReserved(my_context ct // Make sure all nodes that part of the recovery aren't full if (!ps->cct->_conf->osd_debug_skip_full_check_in_recovery && - ps->pg->osd->check_osdmap_full(ps->acting_recovery_backfill)) { + ps->get_osdmap()->check_full(ps->acting_recovery_backfill)) { post_event(RecoveryTooFull()); return; } diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 09f6845e6c91..b0e2e817de2c 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -15174,11 +15174,6 @@ void PrimaryLogPG::_scrub_finish() object_contexts.clear(); } -bool PrimaryLogPG::check_osdmap_full(const set &missing_on) -{ - return osd->check_osdmap_full(missing_on); -} - int PrimaryLogPG::rep_repair_primary_object(const hobject_t& soid, OpContext *ctx) { OpRequestRef op = ctx->op; diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index e31a099fb5fc..6d0bd4315b1b 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -1868,7 +1868,6 @@ public: void on_removal(ObjectStore::Transaction *t) override; void on_shutdown() override; bool check_failsafe_full() override; - bool check_osdmap_full(const set &missing_on) override; bool maybe_preempt_replica_scrub(const hobject_t& oid) override { return write_blocked_by_scrub(oid); }