]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: drive log flush and cache trim during recall
authorPatrick Donnelly <pdonnell@redhat.com>
Sat, 16 Feb 2019 22:33:20 +0000 (14:33 -0800)
committerPatrick Donnelly <pdonnell@redhat.com>
Tue, 19 Feb 2019 00:25:05 +0000 (16:25 -0800)
While waiting for clients to release caps, get to work flushing the journal and
trimming the cache during free time. Both are throttled so it's good to get to
work on this ASAP.

Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
src/mds/MDSRank.cc

index 71112cd0839d2d275fa945458950fd80c4fcf5ba..7228bbe51e86c624541ec38a8d1d30921d2c20cf 100644 (file)
@@ -313,6 +313,15 @@ private:
     Context *timer_task = nullptr;
   };
 
+  auto do_trim() {
+    auto [throttled, count] = mdcache->trim(UINT64_MAX);
+    dout(10) << __func__
+             << (throttled ? " (throttled)" : "")
+             << " trimmed " << count << " caps" << dendl;
+    dentries_trimmed += count;
+    return std::make_pair(throttled, count);
+  }
+
   void recall_client_state() {
     dout(20) << __func__ << dendl;
     auto now = mono_clock::now();
@@ -333,6 +342,8 @@ private:
       ctx->start_timer();
       gather->set_finisher(new MDSInternalContextWrapper(mds, ctx));
       gather->activate();
+      mdlog->flush(); /* use down-time to incrementally flush log */
+      do_trim(); /* use down-time to incrementally trim cache */
     } else {
       if (!gather->has_subs()) {
         delete gather;
@@ -401,11 +412,7 @@ private:
   void trim_cache() {
     dout(20) << __func__ << dendl;
 
-    auto [throttled, count] = mdcache->trim(UINT64_MAX);
-    dout(10) << __func__
-             << (throttled ? " (throttled)" : "")
-             << " trimmed " << count << " caps" << dendl;
-    dentries_trimmed += count;
+    auto [throttled, count] = do_trim();
     if (throttled && count > 0) {
       auto timer = new FunctionContext([this](int _) {
         trim_cache();