]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore/bluefs_types: consolidate contiguous extents 28862/head
authorSage Weil <sage@redhat.com>
Mon, 1 Jul 2019 14:33:22 +0000 (09:33 -0500)
committerSage Weil <sage@redhat.com>
Tue, 20 Aug 2019 16:10:07 +0000 (11:10 -0500)
If we allocate a new extent that is contiguous with the last extent,
just extend it.  This avoids having long vectors of continguous extents
when a single large extent would suffice--especially with log files.

Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 4f3ce9bc201c20d10d739d42e3f7018408f110a6)

src/os/bluestore/bluefs_types.h

index 6e67f49bf70b97fb51a1127b865e816345719667..9c8511711b38cdf63ace36e09ca7bc0aa03eea8c 100644 (file)
@@ -88,8 +88,14 @@ struct bluefs_fnode_t {
   }
 
   void append_extent(const bluefs_extent_t& ext) {
-    extents_index.emplace_back(allocated);
-    extents.push_back(ext);
+    if (!extents.empty() &&
+       extents.back().end() == ext.offset &&
+       (uint64_t)extents.back().length + (uint64_t)ext.length < 0xffffffff) {
+      extents.back().length += ext.length;
+    } else {
+      extents_index.emplace_back(allocated);
+      extents.push_back(ext);
+    }
     allocated += ext.length;
   }