From: Greg Farnum Date: Tue, 11 Feb 2014 20:51:19 +0000 (-0800) Subject: OSD: use the osdmap_subscribe helper X-Git-Tag: v0.67.8~33^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4584f60653bee0305e85418323d80332ceecd0cf;p=ceph.git OSD: use the osdmap_subscribe helper Signed-off-by: Greg Farnum Reviewed-by: Sage Weil (cherry picked from commit 3c76b81f2f96b790b72f2088164ed8e9d5efbba1) --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 6d1979c0ecc..56db88d2185 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -2859,8 +2859,7 @@ void OSD::handle_osd_ping(MOSDPing *m) case MOSDPing::YOU_DIED: dout(10) << "handle_osd_ping " << m->get_source_inst() << " says i am down in " << m->map_epoch << dendl; - if (monc->sub_want("osdmap", m->map_epoch, CEPH_SUBSCRIBE_ONETIME)) - monc->renew_subs(); + osdmap_subscribe(m->map_epoch, false); break; } @@ -2984,8 +2983,7 @@ void OSD::heartbeat() if (now - last_mon_heartbeat > g_conf->osd_mon_heartbeat_interval && is_active()) { last_mon_heartbeat = now; dout(10) << "i have no heartbeat peers; checking mon for new map" << dendl; - monc->sub_want("osdmap", osdmap->get_epoch() + 1, CEPH_SUBSCRIBE_ONETIME); - monc->renew_subs(); + osdmap_subscribe(osdmap->get_epoch() + 1, true); } } @@ -3456,10 +3454,9 @@ void OSD::_maybe_boot(epoch_t oldest, epoch_t newest) // get all the latest maps if (osdmap->get_epoch() > oldest) - monc->sub_want("osdmap", osdmap->get_epoch(), CEPH_SUBSCRIBE_ONETIME); + osdmap_subscribe(osdmap->get_epoch(), true); else - monc->sub_want("osdmap", oldest - 1, CEPH_SUBSCRIBE_ONETIME); - monc->renew_subs(); + osdmap_subscribe(oldest - 1, true); } void OSD::start_waiting_for_healthy() @@ -4872,8 +4869,7 @@ void OSD::wait_for_new_map(OpRequestRef op) { // ask? if (waiting_for_osdmap.empty()) { - monc->sub_want("osdmap", osdmap->get_epoch() + 1, CEPH_SUBSCRIBE_ONETIME); - monc->renew_subs(); + osdmap_subscribe(osdmap->get_epoch() + 1, true); } logger->inc(l_osd_waiting_for_map); @@ -4990,8 +4986,7 @@ void OSD::handle_osd_map(MOSDMap *m) dout(10) << "handle_osd_map message skips epochs " << osdmap->get_epoch() + 1 << ".." << (first-1) << dendl; if (m->oldest_map <= osdmap->get_epoch() + 1) { - monc->sub_want("osdmap", osdmap->get_epoch()+1, CEPH_SUBSCRIBE_ONETIME); - monc->renew_subs(); + osdmap_subscribe(osdmap->get_epoch()+1, true); m->put(); return; } @@ -5000,8 +4995,7 @@ void OSD::handle_osd_map(MOSDMap *m) // 2- is at present the only way to ensure that we get a *full* map as // the first map! if (m->oldest_map < first) { - monc->sub_want("osdmap", m->oldest_map - 1, CEPH_SUBSCRIBE_ONETIME); - monc->renew_subs(); + osdmap_subscribe(m->oldest_map - 1, true); m->put(); return; } @@ -5244,8 +5238,7 @@ void OSD::handle_osd_map(MOSDMap *m) if (m->newest_map && m->newest_map > last) { dout(10) << " msg say newest map is " << m->newest_map << ", requesting more" << dendl; - monc->sub_want("osdmap", osdmap->get_epoch()+1, CEPH_SUBSCRIBE_ONETIME); - monc->renew_subs(); + osdmap_subscribe(osdmap->get_epoch()+1, true); } else if (is_booting()) { start_boot(); // retry @@ -5489,8 +5482,7 @@ void OSD::activate_map() if (osdmap->test_flag(CEPH_OSDMAP_FULL)) { dout(10) << " osdmap flagged full, doing onetime osdmap subscribe" << dendl; - monc->sub_want("osdmap", osdmap->get_epoch() + 1, CEPH_SUBSCRIBE_ONETIME); - monc->renew_subs(); + osdmap_subscribe(osdmap->get_epoch() + 1, true); } // norecover?