]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: align BitMap allocator's init_rm_free/init_add_free parameters with...
authorIgor Fedotov <ifedotov@suse.com>
Fri, 11 May 2018 21:26:49 +0000 (00:26 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Tue, 12 Jun 2018 11:48:44 +0000 (14:48 +0300)
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
src/os/bluestore/BitmapFastAllocator.cc
src/os/bluestore/fastbmap_allocator_impl.h

index 2733ccd060d432f84d22b011f86227b1b45e3785..9c5339d4490164e837c896c9c34e23670808e9c2 100755 (executable)
@@ -53,13 +53,21 @@ void BitmapFastAllocator::init_add_free(uint64_t offset, uint64_t length)
 {
   ldout(cct, 10) << __func__ << " 0x" << std::hex << offset << "~" << length
                  << std::dec << dendl;
-  _mark_free(offset, length);
+
+  auto mas = get_min_alloc_size();
+  uint64_t offs = round_up_to(offset, mas);
+  uint64_t l = p2align(offset + length - offs, mas);
+
+  _mark_free(offs, l);
 }
 void BitmapFastAllocator::init_rm_free(uint64_t offset, uint64_t length)
 {
   ldout(cct, 10) << __func__ << " 0x" << std::hex << offset << "~" << length
                 << std::dec << dendl;
-  _mark_allocated(offset, length);
+  auto mas = get_min_alloc_size();
+  uint64_t offs = round_up_to(offset, mas);
+  uint64_t l = p2align(offset + length - offs, mas);
+  _mark_allocated(offs, l);
 }
 
 void BitmapFastAllocator::shutdown()
index fe8e94e33b7444b59c9a9a7cedea65e0195dac59..271d628cf9ee7acc5e97c43abda330a5f3873bd2 100755 (executable)
@@ -103,6 +103,12 @@ protected:
   inline bool _is_slot_fully_allocated(uint64_t idx) const {
     return l1[idx] == all_slot_clear;
   }
+public:
+  inline uint64_t get_min_alloc_size() const
+  {
+    return l0_granularity;
+  }
+
 };
 
 template <class T>
@@ -537,6 +543,10 @@ public:
     std::lock_guard<std::mutex> l(lock);
     return available;
   }
+  inline uint64_t get_min_alloc_size() const
+  {
+    return l1.get_min_alloc_size();
+  }
 
 protected:
   std::mutex lock;