From: Mingxin Liu Date: Thu, 28 May 2015 06:38:58 +0000 (+0800) Subject: Osd: implement low speed flush X-Git-Tag: v9.0.3~134^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fa000d0e63a53b2f32d3f745e4acf7c1ae9ecbcf;p=ceph.git Osd: implement low speed flush Signed-off-by: Mingxin Liu Reviewed-by: Li Wang Suggested-by: Nick Fisk --- diff --git a/src/common/config_opts.h b/src/common/config_opts.h index b259ec58f5a5..40aa3a863620 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -484,6 +484,7 @@ OPTION(osd_backfill_retry_interval, OPT_DOUBLE, 10.0) // max agent flush ops OPTION(osd_agent_max_ops, OPT_INT, 4) +OPTION(osd_agent_max_low_ops, OPT_INT, 2) OPTION(osd_agent_min_evict_effort, OPT_FLOAT, .1) OPTION(osd_agent_quantize_effort, OPT_FLOAT, .1) OPTION(osd_agent_delay_time, OPT_FLOAT, 5.0) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index e6393855132b..28d607546fbc 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -529,8 +529,12 @@ void OSDService::agent_entry() } PGRef pg = *agent_queue_pos; int max = g_conf->osd_agent_max_ops - agent_ops; + int agent_flush_quota = max; + if (!flush_mode_high_count) + agent_flush_quota = g_conf->osd_agent_max_low_ops - agent_ops; + dout(10) << "high_count " << flush_mode_high_count << " agent_ops " << agent_ops << " flush_quota " << agent_flush_quota << dendl; agent_lock.Unlock(); - if (!pg->agent_work(max)) { + if (!pg->agent_work(max, agent_flush_quota)) { dout(10) << __func__ << " " << *pg << " no agent_work, delay for " << g_conf->osd_agent_delay_time << " seconds" << dendl; diff --git a/src/osd/PG.h b/src/osd/PG.h index d51c2c96c79c..820ac8ee462a 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -2264,6 +2264,7 @@ public: virtual void get_watchers(std::list&) = 0; virtual bool agent_work(int max) = 0; + virtual bool agent_work(int max, int agent_flush_quota) = 0; virtual void agent_stop() = 0; virtual void agent_delay() = 0; virtual void agent_clear() = 0; diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index a59958425660..96f8b53440a8 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -10517,7 +10517,7 @@ void ReplicatedPG::agent_clear() } // Return false if no objects operated on since start of object hash space -bool ReplicatedPG::agent_work(int start_max) +bool ReplicatedPG::agent_work(int start_max, int agent_flush_quota) { lock(); if (!agent_state) { @@ -10621,8 +10621,10 @@ bool ReplicatedPG::agent_work(int start_max) } if (agent_state->flush_mode != TierAgentState::FLUSH_MODE_IDLE && - agent_maybe_flush(obc)) + agent_flush_quota > 0 && agent_maybe_flush(obc)) { ++started; + --agent_flush_quota; + } if (agent_state->evict_mode != TierAgentState::EVICT_MODE_IDLE && agent_maybe_evict(obc)) ++started; diff --git a/src/osd/ReplicatedPG.h b/src/osd/ReplicatedPG.h index f2dfca9faf16..77763bb49fc2 100644 --- a/src/osd/ReplicatedPG.h +++ b/src/osd/ReplicatedPG.h @@ -910,7 +910,11 @@ protected: friend struct C_HitSetFlushing; void agent_setup(); ///< initialize agent state - bool agent_work(int max); ///< entry point to do some agent work + bool agent_work(int max) ///< entry point to do some agent work + { + return agent_work(max, max); + } + bool agent_work(int max, int agent_flush_quota); bool agent_maybe_flush(ObjectContextRef& obc); ///< maybe flush bool agent_maybe_evict(ObjectContextRef& obc); ///< maybe evict