]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: observe 'notieragent' osdmap flag
authorSage Weil <sage@inktank.com>
Mon, 27 Jan 2014 23:30:28 +0000 (15:30 -0800)
committerSage Weil <sage@inktank.com>
Sun, 16 Feb 2014 06:09:38 +0000 (22:09 -0800)
Pause/unpause the agent thread accordingly.

Signed-off-by: Sage Weil <sage@inktank.com>
src/osd/OSD.cc
src/osd/OSD.h

index 6731b5229e05a81549f2e09718c93157d9b1119c..a5e29ce212290dfbc8d35820f6351666b85678d9 100644 (file)
@@ -194,6 +194,7 @@ OSDService::OSDService(OSD *osd) :
   agent_lock("OSD::agent_lock"),
   agent_queue_pos(agent_queue.begin()),
   agent_ops(0),
+  agent_active(true),
   agent_thread(this),
   agent_stop_flag(false),
   objecter_lock("OSD::objecter_lock"),
@@ -450,6 +451,15 @@ void OSDService::init()
   agent_thread.create();
 }
 
+void OSDService::activate_map()
+{
+  // wake/unwake the tiering agent
+  agent_lock.Lock();
+  agent_active = !osdmap->test_flag(CEPH_OSDMAP_NOTIERAGENT);
+  agent_cond.Signal();
+  agent_lock.Unlock();
+}
+
 void OSDService::agent_entry()
 {
   dout(10) << __func__ << " start" << dendl;
@@ -459,9 +469,11 @@ void OSDService::agent_entry()
             << " pgs " << agent_queue.size()
             << " ops " << agent_ops << "/"
             << g_conf->osd_agent_max_ops
+            << (agent_active ? " active" : " NOT ACTIVE")
             << dendl;
     dout(20) << __func__ << " oids " << agent_oids << dendl;
-    if (agent_ops >= g_conf->osd_agent_max_ops || agent_queue.empty()) {
+    if (agent_ops >= g_conf->osd_agent_max_ops || agent_queue.empty() ||
+       !agent_active) {
       agent_cond.Wait(agent_lock);
       continue;
     }
@@ -5631,6 +5643,8 @@ void OSD::activate_map()
     }
   }
 
+  service.activate_map();
+
   // process waiters
   take_waiters(waiting_for_osdmap);
 }
index f029e21ac8bb6f3293e2086f87af834a1eadb96e..95d14ff8262ff129b50b9b17e0a33c06b59e1710 100644 (file)
@@ -359,6 +359,9 @@ public:
     Mutex::Locker l(pre_publish_lock);
     next_osdmap = map;
   }
+
+  void activate_map();
+
   ConnectionRef get_con_osd_cluster(int peer, epoch_t from_epoch);
   pair<ConnectionRef,ConnectionRef> get_con_osd_hb(int peer, epoch_t from_epoch);  // (back, front)
   void send_message_osd_cluster(int peer, Message *m, epoch_t from_epoch);
@@ -435,6 +438,7 @@ public:
   set<PGRef>::iterator agent_queue_pos;
   int agent_ops;
   set<hobject_t> agent_oids;
+  bool agent_active;
   struct AgentThread : public Thread {
     OSDService *osd;
     AgentThread(OSDService *o) : osd(o) {}