From cb4aa3a7166b75e375b6eb44b79e38ed1a9e6470 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 27 Jan 2014 15:30:28 -0800 Subject: [PATCH] osd: observe 'notieragent' osdmap flag Pause/unpause the agent thread accordingly. Signed-off-by: Sage Weil --- src/osd/OSD.cc | 16 +++++++++++++++- src/osd/OSD.h | 4 ++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 6731b5229e0..a5e29ce2122 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 f029e21ac8b..95d14ff8262 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) {} -- 2.47.3