]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/os/bluestore/BtreeAllocator.cc
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / os / bluestore / BtreeAllocator.cc
index 6184375db81eb0d84f79b0f6d24cca6564681e09..cf08d7ae7d31f0fa14af2df2a157022b7339f849 100644 (file)
@@ -3,6 +3,7 @@
 
 #include "BtreeAllocator.h"
 
+#include <bit>
 #include <limits>
 
 #include "common/config_proxy.h"
@@ -373,7 +374,7 @@ int64_t BtreeAllocator::allocate(
                  << " max_alloc_size 0x" << max_alloc_size
                  << " hint 0x" << hint
                  << std::dec << dendl;
-  ceph_assert(isp2(unit));
+  ceph_assert(std::has_single_bit(unit));
   ceph_assert(want % unit == 0);
 
   if (max_alloc_size == 0) {
@@ -429,8 +430,9 @@ void BtreeAllocator::_dump() const
   }
 }
 
-void BtreeAllocator::dump(std::function<void(uint64_t offset, uint64_t length)> notify)
+void BtreeAllocator::foreach(std::function<void(uint64_t offset, uint64_t length)> notify)
 {
+  std::lock_guard l(lock);
   for (auto& rs : range_tree) {
     notify(rs.first, rs.second - rs.first);
   }