summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2013-04-07 08:48:22 -0700
committerSage Weil <sage@inktank.com>2013-04-29 11:07:08 -0700
commit28d495a37157faaefe699f1de5e1675a914f7118 (patch)
treecb840c89781baafc45d311fe68cac18d346b3d73
parentf8f762a2814dc778da7027998126b60bd260d099 (diff)
downloadceph-28d495a37157faaefe699f1de5e1675a914f7118.tar.gz
mon: factor map_pg_creates() out of send_pg_creates()
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>
-rw-r--r--src/mon/PGMonitor.cc26
-rw-r--r--src/mon/PGMonitor.h1
2 files changed, 22 insertions, 5 deletions
diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc
index fe50b34da8c..5f325b9846c 100644
--- a/src/mon/PGMonitor.cc
+++ b/src/mon/PGMonitor.cc
@@ -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 ";
diff --git a/src/mon/PGMonitor.h b/src/mon/PGMonitor.h
index de78e984ae9..3b82f131d87 100644
--- a/src/mon/PGMonitor.h
+++ b/src/mon/PGMonitor.h
@@ -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);