]> 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>
Tue, 29 Jan 2019 23:16:30 +0000 (15:16 -0800)
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/mds/MDSRank.cc

index a0892371cbaf8c527a52d885631f3f8d594492ce..ac9ce862161f90e7956253ff3754f40b23750790 100644 (file)
@@ -379,13 +379,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() {