]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: optimize purge queue expire pos update 21472/head
authorYan, Zheng <zyan@redhat.com>
Tue, 17 Apr 2018 13:05:53 +0000 (21:05 +0800)
committerYan, Zheng <zyan@redhat.com>
Tue, 17 Apr 2018 13:05:53 +0000 (21:05 +0800)
Fixes: http://tracker.ceph.com/issues/23755
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
src/mds/PurgeQueue.cc
src/mds/PurgeQueue.h

index 9ba21ef61b11dbe5951e59f02d33ef62e0728cc7..e43263ccd7aab30cc4dd9497cd623cb4fe8f6960 100644 (file)
@@ -513,14 +513,30 @@ void PurgeQueue::_execute_item_complete(
   auto iter = in_flight.find(expire_to);
   assert(iter != in_flight.end());
   if (iter == in_flight.begin()) {
-    // This was the lowest journal position in flight, so we can now
-    // safely expire the journal up to here.
-    dout(10) << "expiring to 0x" << std::hex << expire_to << std::dec << dendl;
-    journaler.set_expire_pos(expire_to);
+    uint64_t pos = expire_to;
+    if (!pending_expire.empty()) {
+      auto n = iter;
+      ++n;
+      if (n == in_flight.end()) {
+       pos = *pending_expire.rbegin();
+       pending_expire.clear();
+      } else {
+       auto p = pending_expire.begin();
+       do {
+         if (*p >= n->first)
+           break;
+         pos = *p;
+         pending_expire.erase(p++);
+       } while (p != pending_expire.end());
+      }
+    }
+    dout(10) << "expiring to 0x" << std::hex << pos << std::dec << dendl;
+    journaler.set_expire_pos(pos);
   } else {
     // This is completely fine, we're not supposed to purge files in
     // order when doing them in parallel.
     dout(10) << "non-sequential completion, not expiring anything" << dendl;
+    pending_expire.insert(expire_to);
   }
 
   ops_in_flight -= _calculate_ops(iter->second);
index 6a13a57ee30360f14d913d0abc8166718d95f99d..079f37631658bfa7560d46056d72f592f7c4d95c 100644 (file)
@@ -95,6 +95,8 @@ protected:
   // Map of Journaler offset to PurgeItem
   std::map<uint64_t, PurgeItem> in_flight;
 
+  std::set<uint64_t> pending_expire;
+
   // Throttled allowances
   uint64_t ops_in_flight;