]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
CacheTier: set cache_min_evict_age is effective 7478/head
authorchangtao <changtao@hihuron.com>
Mon, 1 Feb 2016 17:23:37 +0000 (01:23 +0800)
committerchangtao <changtao@hihuron.com>
Thu, 4 Feb 2016 14:08:07 +0000 (22:08 +0800)
Signed-off-by: Tao Chang <changtao@hihuron.com>
src/osd/ReplicatedPG.cc

index 752ef73b5c1c493e189908e3b0c53ff2d171ce90..ae4b2a36c1109a8cba967c501ce2e86a785b841c 100644 (file)
@@ -11766,6 +11766,19 @@ bool ReplicatedPG::agent_maybe_evict(ObjectContextRef& obc, bool after_flush)
   }
 
   if (agent_state->evict_mode != TierAgentState::EVICT_MODE_FULL) {
+    // is this object old than cache_min_evict_age?
+    utime_t now = ceph_clock_now(NULL);
+    utime_t ob_local_mtime;
+    if (obc->obs.oi.local_mtime != utime_t()) {
+      ob_local_mtime = obc->obs.oi.local_mtime;
+    } else {
+      ob_local_mtime = obc->obs.oi.mtime;
+    }
+    if (ob_local_mtime + utime_t(pool.info.cache_min_evict_age, 0) > now) {
+      dout(20) << __func__ << " skip (too young) " << obc->obs.oi << dendl;
+      osd->logger->inc(l_osd_agent_skip);
+      return false;
+    }
     // is this object old and/or cold enough?
     int temp = 0;
     uint64_t temp_upper = 0, temp_lower = 0;