]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Bluestore : cleanup, got rid of table reference of 1<<x 13718/head
authorAdam Kupczyk <akupczyk@mirantis.com>
Tue, 28 Feb 2017 14:30:45 +0000 (15:30 +0100)
committerAdam Kupczyk <akupczyk@mirantis.com>
Wed, 8 Mar 2017 09:09:01 +0000 (10:09 +0100)
Signed-off-by: Adam Kupczyk <akupczyk@mirantis.com>
src/os/bluestore/BitAllocator.cc
src/os/bluestore/BitAllocator.h

index 616853841204d0faafeceee0fea0f2c1d5d57733..3c44a640e097d0357592fc0472716b765bafb895 100644 (file)
@@ -41,8 +41,6 @@ int64_t BitMapAreaLeaf::count = 0;
 int64_t BitMapZone::count = 0;
 int64_t BitMapZone::total_blocks = 0;
 
-bool BmapEntry::m_bit_mask_init = false;
-bmap_mask_vec_t BmapEntry::m_bit_to_mask;
 
 
 int64_t BmapEntityListIter::index()
@@ -50,30 +48,8 @@ int64_t BmapEntityListIter::index()
   return m_cur_idx;
 }
 
-/*
- * Bitmap Entry functions.
- */
-void BmapEntry::_init_bit_mask()
-{
-
-  if (m_bit_mask_init) {
-    return;
-  }
-
-  m_bit_to_mask.reserve(BmapEntry::size());
-
-  uint64_t bmask = ((bmap_t) 0x1 << (BmapEntry::size() - 1));
-  for (int i = 0; i < BmapEntry::size(); i++) {
-    m_bit_to_mask[i] = bmask >> i;
-  }
-  BmapEntry::m_bit_mask_init = true;
-}
-
 BmapEntry::BmapEntry(CephContext*, const bool full)
 {
-
-  BmapEntry::_init_bit_mask();
-
   if (full) {
     m_bits = BmapEntry::full_bmask();
   } else {
@@ -86,37 +62,11 @@ BmapEntry::~BmapEntry()
 
 }
 
-bmap_t BmapEntry::full_bmask() {
-  return (bmap_t) -1;
-}
-
-int64_t BmapEntry::size() {
-  return (sizeof(bmap_t) * 8);
-}
-
-bmap_t BmapEntry::empty_bmask() {
-  return (bmap_t) 0;
-}
-
-bmap_t BmapEntry::align_mask(int x)
-{
-  return ((x) >= BmapEntry::size()? (bmap_t) -1 : (~(((bmap_t) -1) >> (x))));
-}
-
-bmap_t BmapEntry::bit_mask(int bit)
-{
-  return m_bit_to_mask[bit];
-}
 bool BmapEntry::check_bit(int bit)
 {
   return (atomic_fetch() & bit_mask(bit));
 }
 
-bmap_t BmapEntry::atomic_fetch()
-{
-  return m_bits;
-}
-
 bool BmapEntry::is_allocated(int64_t offset, int64_t num_bits)
 {
   bmap_t bmask = BmapEntry::align_mask(num_bits) >> offset;
index a90d760dde1321b9cecd4e6410b860d9f4cc0c08..338a9c716a524b479848da751a1712d6a97bcc62 100644 (file)
@@ -141,20 +141,27 @@ typedef mempool::bluestore_alloc::vector<bmap_t> bmap_mask_vec_t;
 class BmapEntry {
 private:
   bmap_t m_bits;
-  static bool m_bit_mask_init;
-  static bmap_mask_vec_t m_bit_to_mask;
-
-
-  static void _init_bit_mask();
 
 public:
   MEMPOOL_CLASS_HELPERS();
-  static bmap_t full_bmask();
-  static int64_t size();
-  static bmap_t empty_bmask();
-  static bmap_t align_mask(int x);
-  static bmap_t bit_mask(int bit_num);
-  bmap_t atomic_fetch();
+  static bmap_t full_bmask() {
+    return (bmap_t) -1;
+  }
+  static int64_t size() {
+    return (sizeof(bmap_t) * 8);
+  }
+  static bmap_t empty_bmask() {
+    return (bmap_t) 0;
+  }
+  static bmap_t align_mask(int x) {
+    return ((x) >= BmapEntry::size()? (bmap_t) -1 : (~(((bmap_t) -1) >> (x))));
+  }
+  static bmap_t bit_mask(int bit_num) {
+    return (bmap_t) 0x1 << ((BmapEntry::size() - 1) - bit_num);
+  }
+  bmap_t atomic_fetch() {
+    return m_bits;
+  }
   BmapEntry(CephContext*, bool val);
   BmapEntry(CephContext*) {
     m_bits = 0;