]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
OSD: use the osdmap_subscribe helper
authorGreg Farnum <greg@inktank.com>
Tue, 11 Feb 2014 20:51:19 +0000 (12:51 -0800)
committerGreg Farnum <greg@inktank.com>
Tue, 25 Feb 2014 19:42:08 +0000 (11:42 -0800)
Signed-off-by: Greg Farnum <greg@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 3c76b81f2f96b790b72f2088164ed8e9d5efbba1)

src/osd/OSD.cc

index 6d1979c0ecc59afe3a7ecbd69ae0fd26a83c71ea..56db88d2185b40f45e2f2e2f07b409ae4cdeb6e8 100644 (file)
@@ -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?