summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2012-11-29 11:10:21 -0800
committerSage Weil <sage@inktank.com>2012-11-29 12:39:44 -0800
commite18f9ee844db8a757d980677bf457fc7dfc4f740 (patch)
tree0b3bfd38870badaa87e9b08a9ba6ef7e227db1dc
parent5bc10ecce305e5e7b1ab53de69b8419521e1aa43 (diff)
downloadceph-e18f9ee844db8a757d980677bf457fc7dfc4f740.tar.gz
osd: add Connection-base send_map(), send_incremental_map()
Signed-off-by: Sage Weil <sage@inktank.com>
-rw-r--r--src/osd/OSD.cc34
-rw-r--r--src/osd/OSD.h2
2 files changed, 36 insertions, 0 deletions
diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc
index da4b18ebeb7..afdc92f2f55 100644
--- a/src/osd/OSD.cc
+++ b/src/osd/OSD.cc
@@ -4068,6 +4068,14 @@ void OSD::send_map(MOSDMap *m, const entity_inst_t& inst, bool lazy)
msgr->send_message(m, inst);
}
+void OSD::send_map(MOSDMap *m, Connection *con)
+{
+ Messenger *msgr = client_messenger;
+ if (entity_name_t::TYPE_OSD == con->get_peer_type())
+ msgr = cluster_messenger;
+ msgr->send_message(m, con);
+}
+
void OSD::send_incremental_map(epoch_t since, const entity_inst_t& inst, bool lazy)
{
dout(10) << "send_incremental_map " << since << " -> " << osdmap->get_epoch()
@@ -4094,6 +4102,32 @@ void OSD::send_incremental_map(epoch_t since, const entity_inst_t& inst, bool la
}
}
+void OSD::send_incremental_map(epoch_t since, Connection *con)
+{
+ dout(10) << "send_incremental_map " << since << " -> " << osdmap->get_epoch()
+ << " to " << con << " " << con->get_peer_addr() << dendl;
+
+ if (since < superblock.oldest_map) {
+ // just send latest full map
+ MOSDMap *m = new MOSDMap(monc->get_fsid());
+ m->oldest_map = superblock.oldest_map;
+ m->newest_map = superblock.newest_map;
+ epoch_t e = osdmap->get_epoch();
+ get_map_bl(e, m->maps[e]);
+ send_map(m, con);
+ return;
+ }
+
+ while (since < osdmap->get_epoch()) {
+ epoch_t to = osdmap->get_epoch();
+ if (to - since > (epoch_t)g_conf->osd_map_message_max)
+ to = since + g_conf->osd_map_message_max;
+ MOSDMap *m = build_incremental_map_msg(since, to);
+ send_map(m, con);
+ since = to;
+ }
+}
+
bool OSDService::_get_map_bl(epoch_t e, bufferlist& bl)
{
bool found = map_bl_cache.lookup(e, &bl);
diff --git a/src/osd/OSD.h b/src/osd/OSD.h
index d9e8de247da..8277e35c7db 100644
--- a/src/osd/OSD.h
+++ b/src/osd/OSD.h
@@ -753,7 +753,9 @@ private:
MOSDMap *build_incremental_map_msg(epoch_t from, epoch_t to);
void send_incremental_map(epoch_t since, const entity_inst_t& inst, bool lazy=false);
+ void send_incremental_map(epoch_t since, Connection *con);
void send_map(MOSDMap *m, const entity_inst_t& inst, bool lazy);
+ void send_map(MOSDMap *m, Connection *con);
protected:
// -- placement groups --