From: Yunchuan Wen Date: Tue, 4 Aug 2015 08:47:05 +0000 (+0000) Subject: Allow evict operations to be throttled X-Git-Tag: v9.1.0~200^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=09839d00c0e1c5bc0e9ee2e1a1d24cb2cf9a1118;p=ceph.git Allow evict operations to be throttled 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 Reviewed-by: Li Wang Reviewed-by: Mingxin Liu --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 4b8c2eb0316c..9dbb30c35829 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -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); diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index 9c280365da27..690da03a0dc2 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -922,6 +922,7 @@ protected: boost::scoped_ptr agent_state; friend struct C_AgentFlushStartStop; + friend struct C_AgentEvictStartStop; friend struct C_HitSetFlushing; void agent_setup(); ///< initialize agent state