From: Sage Weil Date: Sun, 7 Apr 2013 15:48:22 +0000 (-0700) Subject: mon: factor map_pg_creates() out of send_pg_creates() X-Git-Tag: v0.61~52^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=28d495a37157faaefe699f1de5e1675a914f7118;p=ceph.git 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 --- diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc index fe50b34da8c2..5f325b9846c6 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::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 >::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 >::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 de78e984ae92..3b82f131d870 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);