]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: factor map_pg_creates() out of send_pg_creates()
authorSage Weil <sage@inktank.com>
Sun, 7 Apr 2013 15:48:22 +0000 (08:48 -0700)
committerSage Weil <sage@inktank.com>
Mon, 29 Apr 2013 18:07:08 +0000 (11:07 -0700)
Factor out the portion of the function that remaps creating pgs to osds
from the part that sends those pending creates out.

Signed-off-by: Sage Weil <sage@inktank.com>
src/mon/PGMonitor.cc
src/mon/PGMonitor.h

index fe50b34da8c24cfb3b785f5a9f16398d766ca667..5f325b9846c67e6522eda382a27e18b9dec6437b 100644 (file)
@@ -212,6 +212,7 @@ void PGMonitor::update_from_paxos()
 
   update_trim();
 
+  map_pg_creates();
   send_pg_creates();
 
   update_logger();
@@ -664,6 +665,7 @@ void PGMonitor::check_osd_map(epoch_t epoch)
   if (propose)
     propose_pending();
 
+  map_pg_creates();
   send_pg_creates();
 }
 
@@ -785,12 +787,10 @@ bool PGMonitor::register_new_pgs()
   return false;
 }
 
-void PGMonitor::send_pg_creates()
+void PGMonitor::map_pg_creates()
 {
-  dout(10) << "send_pg_creates to " << pg_map.creating_pgs.size() << " pgs" << dendl;
+  dout(10) << "map_pg_creates to " << pg_map.creating_pgs.size() << " pgs" << dendl;
 
-  utime_t now = ceph_clock_now(g_ceph_context);
-  
   for (set<pg_t>::iterator p = pg_map.creating_pgs.begin();
        p != pg_map.creating_pgs.end();
        ++p) {
@@ -820,12 +820,23 @@ void PGMonitor::send_pg_creates()
     if (nrep) {
       pg_map.creating_pgs_by_osd[acting[0]].insert(pgid);
     } else {
-      dout(20) << "send_pg_creates  " << pgid << " -> no osds in epoch "
+      dout(20) << "map_pg_creates  " << pgid << " -> no osds in epoch "
               << mon->osdmon()->osdmap.get_epoch() << ", skipping" << dendl;
       continue;  // blarney!
     }
   }
+  for (map<int, set<pg_t> >::iterator p = pg_map.creating_pgs_by_osd.begin();
+       p != pg_map.creating_pgs_by_osd.end();
+       ++p) {
+    dout(10) << "map_pg_creates osd." << p->first << " has " << p->second.size() << " pgs" << dendl;
+  }
+}
+
+void PGMonitor::send_pg_creates()
+{
+  dout(10) << "send_pg_creates to " << pg_map.creating_pgs.size() << " pgs" << dendl;
 
+  utime_t now = ceph_clock_now(g_ceph_context);
   for (map<int, set<pg_t> >::iterator p = pg_map.creating_pgs_by_osd.begin();
        p != pg_map.creating_pgs_by_osd.end();
        ++p) {
@@ -1084,6 +1095,11 @@ bool PGMonitor::preprocess_command(MMonCommand *m)
       ss << "got pgmap version " << pg_map.version;
       r = 0;
     }
+    else if (m->cmd[1] == "map_pg_creates") {
+      map_pg_creates();
+      ss << "mapped pg creates ";
+      r = 0;
+    }
     else if (m->cmd[1] == "send_pg_creates") {
       send_pg_creates();
       ss << "sent pg creates ";
index de78e984ae9285a1b8cc22e366215ec9dfae4103..3b82f131d87009b6f7039b61d77afe7409a9f371 100644 (file)
@@ -109,6 +109,7 @@ private:
    */
   bool register_new_pgs();
 
+  void map_pg_creates();
   void send_pg_creates();
   void send_pg_creates(int osd, Connection *con);