]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: kill dead code 8902/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Tue, 26 Apr 2016 09:08:38 +0000 (17:08 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Tue, 3 May 2016 13:28:09 +0000 (21:28 +0800)
These codes are not applicable any more,
and removing unnecessary code is always the preferred option.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/mon/OSDMonitor.cc
src/mon/OSDMonitor.h
src/osd/OSDMap.h

index b7b48927541a2d64e4c6c84c8a59d3ec32788c4f..bf6c4baf204273df7e94d1ecd38b578167c03182 100644 (file)
@@ -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<int> 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<int32_t> ls;
-  osdmap.get_all_osds(ls);
-  for (set<int32_t>::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<pair<health_status_t,string> >& summary,
                            list<pair<health_status_t,string> > *detail,
                            CephContext *cct) const
index 3451b6a7e07146bdff6d7082dfb5d38edbbf5cb2..548e13ca676957b77db6b991ae821d264cb96c00 100644 (file)
@@ -418,7 +418,6 @@ private:
 
   void handle_osd_timeouts(const utime_t &now,
                           std::map<int,utime_t> &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) {
index 487baca665328965381cb982887d04d1a051c492..5b76e0ac31037bf6860888980b6f8190dc90c780 100644 (file)
@@ -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<int> *down_cache) const;
   bool containing_subtree_is_down(CephContext *cct, int osd, int subtree_type, set<int> *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<int> 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<int> acting;
     int nrep = pg_to_acting_osds(pg, acting);