]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/os/seastore: correct possible mergeable size for ool extents
authormyoungwon oh <ohmyoungwon@gmail.com>
Thu, 21 Aug 2025 06:03:07 +0000 (06:03 +0000)
committermyoungwon oh <ohmyoungwon@gmail.com>
Thu, 21 Aug 2025 06:03:07 +0000 (06:03 +0000)
Current implementation only checks a previous ool extent
before writing a ool extent. This can miss merge opportunities
for extents that are sequential but precede the last OOL extent.

This commit fixes this by reporting a correct mergeable size.

Signed-off-by: Myoungwon Oh <ohmyoungwon@gmail.com>
src/crimson/os/seastore/extent_placement_manager.cc
src/crimson/os/seastore/extent_placement_manager.h

index be53c9c292c1dbbf788d7fbecbc0316d550e1f21..b7572a366f97f8e790aeff0d4dc233a3f30b2ce7 100644 (file)
@@ -1068,7 +1068,7 @@ RandomBlockOolWriter::do_write(
 
     // TODO : allocate a consecutive address based on a transaction
     if (writes.size() != 0 &&
-        writes.back().offset + writes.back().bp.length() == paddr) {
+       writes.back().offset + writes.back().get_mergeable_length() == paddr) {
       // We can write both the currrent extent and the previous one at once
       // if the extents are located in a row
       if (writes.back().mergeable_bps.size() == 0) {
index 95378d558e62bc5b5566177785774356345f0286..d5361359a56a2bb9f3f6856a79638bb8847ee5e5 100644 (file)
@@ -195,6 +195,17 @@ private:
     ceph::bufferptr bp;
     RandomBlockManager* rbm;
     std::list<ceph::bufferptr> mergeable_bps;
+
+    extent_len_t get_mergeable_length() const {
+      if (mergeable_bps.size() == 0) {
+       return bp.length();
+      }
+      extent_len_t len = 0;
+      for (auto &p : mergeable_bps) {
+       len += p.length();
+      }
+      return len;
+    }
   };
   alloc_write_iertr::future<> do_write(
     Transaction& t,