From: Sage Weil Date: Mon, 27 Jan 2014 23:30:28 +0000 (-0800) Subject: osd: observe 'notieragent' osdmap flag X-Git-Tag: v0.78~166^2~24 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cb4aa3a7166b75e375b6eb44b79e38ed1a9e6470;p=ceph.git osd: observe 'notieragent' osdmap flag Pause/unpause the agent thread accordingly. Signed-off-by: Sage Weil --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 6731b5229e05..a5e29ce21229 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -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); } diff --git a/src/osd/OSD.h b/src/osd/OSD.h index f029e21ac8bb..95d14ff8262f 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -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 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::iterator agent_queue_pos; int agent_ops; set agent_oids; + bool agent_active; struct AgentThread : public Thread { OSDService *osd; AgentThread(OSDService *o) : osd(o) {}