]> 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)
committerVenky Shankar <vshankar@redhat.com>
Thu, 4 Apr 2019 07:12:17 +0000 (03:12 -0400)
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>
(cherry picked from commit 57e413e87a85aceff78a1f69b6c0396fc524d98e)

 Conflicts:
src/mds/MDSRank.cc

src/mds/MDSRank.cc

index 62518ae83dcd6a8d509ddd44889cd1620a5834cc..dbc5a7ad86101f78878e3ea122a300f5cf550bce 100644 (file)
@@ -316,6 +316,17 @@ private:
     Context *timer_task = nullptr;
   };
 
+  std::pair<bool, uint64_t> do_trim() {
+    auto p = mdcache->trim(UINT64_MAX);
+    auto& throttled = p.first;
+    auto& count = p.second;
+    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();
@@ -338,6 +349,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;
@@ -406,13 +419,9 @@ private:
   void trim_cache() {
     dout(20) << __func__ << dendl;
 
-    auto p = mdcache->trim(UINT64_MAX);
+    auto p = do_trim();
     auto& throttled = p.first;
     auto& count = p.second;
-    dout(10) << __func__
-             << (throttled ? " (throttled)" : "")
-             << " trimmed " << count << " caps" << dendl;
-    dentries_trimmed += count;
     if (throttled && count > 0) {
       auto timer = new FunctionContext([this](int _) {
         trim_cache();