From 6fea83adffb3b761fb8854751471c065b8b1ea0c Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Tue, 26 Apr 2016 17:08:38 +0800 Subject: [PATCH] mon/OSDMonitor: kill dead code These codes are not applicable any more, and removing unnecessary code is always the preferred option. Signed-off-by: xie xingguo --- src/mon/OSDMonitor.cc | 43 ------------------------------------------- src/mon/OSDMonitor.h | 1 - src/osd/OSDMap.h | 10 ++-------- 3 files changed, 2 insertions(+), 52 deletions(-) diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index b7b48927541a2..bf6c4baf20427 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -539,14 +539,12 @@ int OSDMonitor::reweight_by_utilization(int oload, int num_osd = MIN(1, pgm.osd_stat.size()); if ((uint64_t)pgm.osd_sum.kb * 1024 / num_osd < g_conf->mon_reweight_min_bytes_per_osd) { - ostringstream oss; *ss << "Refusing to reweight: we only have " << pgm.osd_sum.kb << " kb across all osds!\n"; return -EDOM; } if ((uint64_t)pgm.osd_sum.kb_used * 1024 / num_osd < g_conf->mon_reweight_min_bytes_per_osd) { - ostringstream oss; *ss << "Refusing to reweight: we only have " << pgm.osd_sum.kb_used << " kb used across all osds!\n"; return -EDOM; @@ -2778,29 +2776,6 @@ void OSDMonitor::tick() do_propose = true; } } - // --------------- -#define SWAP_PRIMARIES_AT_START 0 -#define SWAP_TIME 1 -#if 0 - if (SWAP_PRIMARIES_AT_START) { - // For all PGs that have OSD 0 as the primary, - // switch them to use the first replca - ps_t numps = osdmap.get_pg_num(); - for (int64_t pool=0; pool<1; pool++) - for (ps_t ps = 0; ps < numps; ++ps) { - pg_t pgid = pg_t(pg_t::TYPE_REPLICATED, ps, pool, -1); - vector osds; - osdmap.pg_to_osds(pgid, osds); - if (osds[0] == 0) { - pending_inc.new_pg_swap_primary[pgid] = osds[1]; - dout(3) << "Changing primary for PG " << pgid << " from " << osds[0] << " to " - << osds[1] << dendl; - do_propose = true; - } - } - } -#endif - // --------------- if (update_pools_status()) do_propose = true; @@ -2843,24 +2818,6 @@ void OSDMonitor::handle_osd_timeouts(const utime_t &now, } } -void OSDMonitor::mark_all_down() -{ - assert(mon->is_leader()); - - dout(7) << "mark_all_down" << dendl; - - set ls; - osdmap.get_all_osds(ls); - for (set::iterator it = ls.begin(); - it != ls.end(); - ++it) { - if (osdmap.is_down(*it)) continue; - pending_inc.new_state[*it] = CEPH_OSD_UP; - } - - propose_pending(); -} - void OSDMonitor::get_health(list >& summary, list > *detail, CephContext *cct) const diff --git a/src/mon/OSDMonitor.h b/src/mon/OSDMonitor.h index 3451b6a7e0714..548e13ca67695 100644 --- a/src/mon/OSDMonitor.h +++ b/src/mon/OSDMonitor.h @@ -418,7 +418,6 @@ private: void handle_osd_timeouts(const utime_t &now, std::map &last_osd_report); - void mark_all_down(); void send_latest(MonOpRequestRef op, epoch_t start=0); void send_latest_now_nodelete(MonOpRequestRef op, epoch_t start=0) { diff --git a/src/osd/OSDMap.h b/src/osd/OSDMap.h index 487baca665328..5b76e0ac31037 100644 --- a/src/osd/OSDMap.h +++ b/src/osd/OSDMap.h @@ -455,7 +455,7 @@ public: } /** - * check if an entire crush subtre is down + * check if an entire crush subtree is down */ bool subtree_is_down(int id, set *down_cache) const; bool containing_subtree_is_down(CephContext *cct, int osd, int subtree_type, set *down_cache) const; @@ -764,13 +764,7 @@ public: return group[0]; return -1; // we fail! } - int get_pg_acting_tail(pg_t pg) const { - vector group; - int nrep = pg_to_acting_osds(pg, group); - if (nrep > 0) - return group[group.size()-1]; - return -1; // we fail! - } + bool is_acting_osd_shard(pg_t pg, int osd, shard_id_t shard) const { vector acting; int nrep = pg_to_acting_osds(pg, acting); -- 2.39.5