]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mdsmap: rename get_num_*_mds() methods
authorSage Weil <sage@newdream.net>
Thu, 8 Dec 2011 21:02:12 +0000 (13:02 -0800)
committerSage Weil <sage@newdream.net>
Mon, 12 Dec 2011 17:27:17 +0000 (09:27 -0800)
Signed-off-by: Sage Weil <sage@newdream.net>
src/client/Client.cc
src/mds/MDBalancer.cc
src/mds/MDS.cc
src/mds/MDSMap.h
src/mon/MDSMonitor.cc
src/tools/gui.cc

index a13ee8f7ee7875b171b4b6de1a9aa0fb321fdae4..3ddbbc700fda6bc3c7db1d5afeb42683c4bf4a67 100644 (file)
@@ -4790,7 +4790,7 @@ int Client::lookup_hash(inodeno_t ino, inodeno_t dirino, const char *name)
   path2.push_dentry(string(f));
   req->set_filepath2(path2);
 
-  int r = make_request(req, -1, -1, NULL, rand() % mdsmap->get_num_mds());
+  int r = make_request(req, -1, -1, NULL, rand() % mdsmap->get_num_in_mds());
   ldout(cct, 3) << "lookup_hash exit(" << ino << ", #" << dirino << "/" << name << ") = " << r << dendl;
   return r;
 }
@@ -4804,7 +4804,7 @@ int Client::lookup_ino(inodeno_t ino)
   filepath path(ino);
   req->set_filepath(path);
 
-  int r = make_request(req, -1, -1, NULL, rand() % mdsmap->get_num_mds());
+  int r = make_request(req, -1, -1, NULL, rand() % mdsmap->get_num_in_mds());
   ldout(cct, 3) << "lookup_ino exit(" << ino << ") = " << r << dendl;
   return r;
 }
index eb8fb7530311d93c9778f1c1e8d7cd1d6edde67a..d81b9ead2e43bfc42c42519666f62d59c8d1620c 100644 (file)
@@ -274,7 +274,7 @@ void MDBalancer::handle_heartbeat(MHeartbeat *m)
   //dout(0) << "  load is " << load << " have " << mds_load.size() << dendl;
 
   {
-    unsigned cluster_size = mds->get_mds_map()->get_num_mds();
+    unsigned cluster_size = mds->get_mds_map()->get_num_in_mds();
     if (mds_load.size() == cluster_size) {
       // let's go!
       //export_empties();  // no!
@@ -433,7 +433,7 @@ void MDBalancer::prep_rebalance(int beat)
         ++i)
       my_targets[*i] = 0.0;
   } else {
-    int cluster_size = mds->get_mds_map()->get_num_mds();
+    int cluster_size = mds->get_mds_map()->get_num_in_mds();
     int whoami = mds->get_nodeid();
     rebalance_time = ceph_clock_now(g_ceph_context);
 
@@ -1050,7 +1050,7 @@ void MDBalancer::hit_dir(utime_t now, CDir *dir, int type, int who, double amoun
          dir_pop >= g_conf->mds_bal_replicate_threshold) {
        // replicate
        float rdp = dir->pop_me.get(META_POP_IRD).get(now, mds->mdcache->decayrate);
-       rd_adj = rdp / mds->get_mds_map()->get_num_mds() - rdp;
+       rd_adj = rdp / mds->get_mds_map()->get_num_in_mds() - rdp;
        rd_adj /= 2.0;  // temper somewhat
 
        dout(0) << "replicating dir " << *dir << " pop " << dir_pop << " .. rdp " << rdp << " adj " << rd_adj << dendl;
index 3cad9d119b23799773835e30b0d206557e138db1..8672fe9d7fe62ad006e2bf9a6c6b6ffcea58a7a0 100644 (file)
@@ -1386,8 +1386,8 @@ void MDS::replay_done()
     inotable->save(new C_NoopContext);
   }
 
-  if (mdsmap->get_num_mds() == 1 &&
-      mdsmap->get_num_failed() == 0) { // just me!
+  if (mdsmap->get_num_in_mds() == 1 &&
+      mdsmap->get_num_failed_mds() == 0) { // just me!
     dout(2) << "i am alone, moving to state reconnect" << dendl;      
     request_state(MDSMap::STATE_RECONNECT);
   } else {
@@ -1531,7 +1531,7 @@ void MDS::stopping_start()
 {
   dout(2) << "stopping_start" << dendl;
 
-  if (mdsmap->get_num_mds() == 1 && !sessionmap.empty()) {
+  if (mdsmap->get_num_in_mds() == 1 && !sessionmap.empty()) {
     // we're the only mds up!
     dout(0) << "we are the last MDS, and have mounted clients: we cannot flush our journal.  suicide!" << dendl;
     suicide();
index 00a46e85ee78e44d344ee6f45cf6ab5f916a697b..e4fdd7a8b754e0948c88c1f96515d8ab11f0a434 100644 (file)
@@ -255,9 +255,15 @@ public:
   }
 
   // counts
-  unsigned get_num_mds() {
+  unsigned get_num_in_mds() {
     return in.size();
   }
+  unsigned get_num_up_mds() {
+    return up.size();
+  }
+  int get_num_failed_mds() {
+    return failed.size();
+  }
   unsigned get_num_mds(int state) {
     unsigned n = 0;
     for (map<uint64_t,mds_info_t>::const_iterator p = mds_info.begin();
@@ -266,7 +272,6 @@ public:
       if (p->second.state == state) ++n;
     return n;
   }
-  int get_num_failed() { return failed.size(); }
 
   // data pools
   void add_data_pg_pool(int64_t poolid) {
index 57043d0f9e83410db3bd11510bee1d38c18e7cb2..5488180c852f229c5962e80851c31acb23734e6a 100644 (file)
@@ -710,7 +710,7 @@ bool MDSMonitor::prepare_command(MMonCommand *m)
           << ceph_mds_state_name(mdsmap.get_state(who)) << ")";
       } else if ((mdsmap.get_root() == who ||
                  mdsmap.get_tableserver() == who) &&
-                mdsmap.get_num_mds() > 1) {
+                mdsmap.get_num_in_mds() > 1) {
        r = -EBUSY;
        ss << "can't tell the root (" << mdsmap.get_root() << ") or tableserver (" << mdsmap.get_tableserver()
           << " to stop unless it is the last mds in the cluster";
@@ -903,7 +903,7 @@ void MDSMonitor::tick()
   if (!mon->is_leader()) return;
 
   // expand mds cluster (add new nodes to @in)?
-  while (pending_mdsmap.get_num_mds() < pending_mdsmap.get_max_mds() &&
+  while (pending_mdsmap.get_num_in_mds() < pending_mdsmap.get_max_mds() &&
         !pending_mdsmap.is_degraded()) {
     int mds = 0;
     string name;
index 05fb32b338851c8beaf6ef0cc2a433318410f483..dcf62e7ae79474620cfb83c18fedbcdec6ad5c2b 100644 (file)
@@ -528,8 +528,8 @@ void GuiMonitor::update_mds_cluster_view()
     view_mds_nodes();
 
   ostringstream oss;
-  oss << ctx->mdsmap.get_num_mds() << " In, "
-      << ctx->mdsmap.get_num_failed() << " Failed, "
+  oss << ctx->mdsmap.get_num_in_mds() << " In, "
+      << ctx->mdsmap.get_num_failed_mds() << " Failed, "
       << ctx->mdsmap.get_num_mds(MDSMap::STATE_STOPPED) << " Stopped, "
       << ctx->mdsmap.get_max_mds() << " Max";
   guiMonitorMDSClusterStatsLabel->set_label(oss.str());
@@ -1516,9 +1516,9 @@ void GuiMonitor::StatsWindowInfo::gen_mds_cluster_columns()
     ctx->mdsmap.get_max_mds()));
   insert_stats("Amount of Up MDSes", str(boost::format("%d") % up_mds.size()));
   insert_stats("Amount of In MDSes", str(boost::format("%u") %
-    ctx->mdsmap.get_num_mds()));
+    ctx->mdsmap.get_num_in_mds()));
   insert_stats("Amount of Failed MDSes", str(boost::format("%d") %
-    ctx->mdsmap.get_num_failed()));
+    ctx->mdsmap.get_num_failed_mds()));
   insert_stats("Amount of Stopped MDSes", str(boost::format("%d") %
     stopped_mds.size()));
 }