]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/os/bluestore/AvlAllocator.cc
import 15.2.9
[ceph.git] / ceph / src / os / bluestore / AvlAllocator.cc
index e9d0510798626b614b01982d977f6f6fe1a7ecc5..0ac70baa80c3acd6cd87c03bfb59d06158730842 100644 (file)
@@ -240,7 +240,15 @@ int AvlAllocator::_allocate(
       max_size < range_size_alloc_threshold ||
       free_pct < range_size_alloc_free_pct) {
     *cursor = 0;
-    start = _block_picker(range_size_tree, cursor, size, unit);
+    do {
+      start = _block_picker(range_size_tree, cursor, size, unit);
+      if (start != -1ULL || !force_range_size_alloc) {
+        break;
+      }
+      // try to collect smaller extents as we could fail to retrieve
+      // that large block due to misaligned extents
+      size = p2align(size >> 1, unit);
+    } while (size >= unit);
   } else {
     start = _block_picker(range_tree, cursor, size, unit);
   }