]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Allow evict operations to be throttled 5463/head
authorYunchuan Wen <yunchuanwen@ubuntukylin.com>
Tue, 4 Aug 2015 08:47:05 +0000 (08:47 +0000)
committerYunchuan Wen <yunchuanwen@ubuntukylin.com>
Tue, 4 Aug 2015 09:10:41 +0000 (09:10 +0000)
In agent_work(), it did not touch agent_ops when
it started an evict operation, so evict operations
were not throttled. This patch fixes it.

Signed-off-by: Yunchuan Wen <yunchuanwen@ubuntukylin.com>
Reviewed-by: Li Wang <liwang@ubuntukylin.com>
Reviewed-by: Mingxin Liu <mingxinliu@ubuntukylin.com>
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index 4b8c2eb0316c8d6f74da71d9ffbec2e22dfc1ae7..9dbb30c358292e6a5538b0719fa55c3801cef961 100644 (file)
@@ -10855,6 +10855,16 @@ bool ReplicatedPG::agent_maybe_flush(ObjectContextRef& obc)
   return true;
 }
 
+struct C_AgentEvictStartStop : public Context {
+  ReplicatedPGRef pg;
+  C_AgentEvictStartStop(ReplicatedPG *p) : pg(p) {
+    pg->osd->agent_start_evict_op();
+  }
+  void finish(int r) {
+    pg->osd->agent_finish_evict_op();
+  }
+};
+
 bool ReplicatedPG::agent_maybe_evict(ObjectContextRef& obc)
 {
   const hobject_t& soid = obc->obs.oi.soid;
@@ -10943,6 +10953,8 @@ bool ReplicatedPG::agent_maybe_evict(ObjectContextRef& obc)
   dout(10) << __func__ << " evicting " << obc->obs.oi << dendl;
   RepGather *repop = simple_repop_create(obc);
   OpContext *ctx = repop->ctx;
+  Context *on_evict = new C_AgentEvictStartStop(this);
+  ctx->on_finish = on_evict;
   ctx->lock_to_release = OpContext::W_LOCK;
   ctx->at_version = get_next_version();
   assert(ctx->new_obs.exists);
index 9c280365da27f7f6b8053a138c0fd8a2ce1d202e..690da03a0dc2101484a1a4b880ebfdc7dc1909a8 100644 (file)
@@ -922,6 +922,7 @@ protected:
   boost::scoped_ptr<TierAgentState> agent_state;
 
   friend struct C_AgentFlushStartStop;
+  friend struct C_AgentEvictStartStop;
   friend struct C_HitSetFlushing;
 
   void agent_setup();       ///< initialize agent state