]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Osd: implement low speed flush
authorMingxin Liu <mingxinliu@ubuntukylin.com>
Thu, 28 May 2015 06:38:58 +0000 (14:38 +0800)
committerliumingxin <mingxinliu@ubuntukylin.com>
Wed, 3 Jun 2015 07:56:42 +0000 (15:56 +0800)
Signed-off-by: Mingxin Liu <mingxinliu@ubuntukylin.com>
Reviewed-by: Li Wang <liwang@ubuntukylin.com>
Suggested-by: Nick Fisk <nick@fisk.me.uk>
src/common/config_opts.h
src/osd/OSD.cc
src/osd/PG.h
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index b259ec58f5a5bd572f80e6c6984b12840cc109aa..40aa3a8636206edf954ed36d104f7e86c27f8032 100644 (file)
@@ -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)
index e6393855132bdde73f7a1be2432aa55692b44587..28d607546fbc084a219c5652244c574c4ae29937 100644 (file)
@@ -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;
index d51c2c96c79c3114a87b01b028b3f82318e9589b..820ac8ee462acac17f19d9e5ee19f9b6932870cd 100644 (file)
@@ -2264,6 +2264,7 @@ public:
   virtual void get_watchers(std::list<obj_watch_item_t>&) = 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;
index a59958425660cde70cf087df7757cbc8d96b1c7c..96f8b53440a8353327860b0c2e51d7df2985d4c0 100644 (file)
@@ -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;
index f2dfca9faf169d6810c8ca412c88cdf000d0ceb9..77763bb49fc216cf2f7025f42cf0b4da8e47eb9f 100644 (file)
@@ -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