]> git-server-git.apps.pok.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)
committerNathan Cutler <ncutler@suse.com>
Thu, 24 Oct 2019 15:51:11 +0000 (17:51 +0200)
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit b750b3b)

src/mds/MDSRank.cc

index 57b0e1ef250995dfcfbfa6dd8aeaf160b1eb92e9..883b5cd8095599a969f56ca4f329cb5cddcd17d9 100644 (file)
@@ -382,13 +382,18 @@ private:
   void trim_cache() {
     dout(20) << __func__ << dendl;
 
-    if (!mdcache->trim(UINT64_MAX)) {
-      cmd_err(f, "failed to trim cache");
-      complete(-EINVAL);
-      return;
+    auto [throttled, count] = mdcache->trim(UINT64_MAX);
+    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() {