]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: adapt drop cache for incremental trim
authorPatrick Donnelly <pdonnell@redhat.com>
Sun, 20 Jan 2019 04:40:11 +0000 (20:40 -0800)
committerPatrick Donnelly <pdonnell@redhat.com>
Mon, 4 Mar 2019 17:19:17 +0000 (09:19 -0800)
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit b750b3bb25d3c0cbad7a24ad6c7fd215d1b16395)

src/mds/MDSRank.cc

index 2e392ce95ff3775a09d7396a4453dfb6692fa051..d27251d6cf7adaf0449c0d33e9cc23ff5fb1996d 100644 (file)
@@ -382,13 +382,20 @@ private:
   void trim_cache() {
     dout(20) << __func__ << dendl;
 
-    if (!mdcache->trim(UINT64_MAX)) {
-      cmd_err(f, "failed to trim cache");
-      complete(-EINVAL);
-      return;
+    auto p = mdcache->trim(UINT64_MAX);
+    auto& throttled = p.first;
+    auto& count = p.second;
+    dout(10) << __func__
+             << (throttled ? " (throttled)" : "")
+             << " trimmed " << count << " caps" << dendl;
+    if (throttled && count > 0) {
+      auto timer = new FunctionContext([this](int _) {
+        trim_cache();
+      });
+      mds->timer.add_event_after(1.0, timer);
+    } else {
+      cache_status();
     }
-
-    cache_status();
   }
 
   void cache_status() {