]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: rename new bitmap allocator class to BitmapAllocator. 21825/head
authorIgor Fedotov <ifedotov@suse.com>
Tue, 12 Jun 2018 11:50:30 +0000 (14:50 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Tue, 12 Jun 2018 11:50:30 +0000 (14:50 +0300)
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
src/os/CMakeLists.txt
src/os/bluestore/Allocator.cc
src/os/bluestore/BitmapAllocator.cc [new file with mode: 0755]
src/os/bluestore/BitmapAllocator.h [new file with mode: 0755]
src/os/bluestore/BitmapFastAllocator.cc [deleted file]
src/os/bluestore/BitmapFastAllocator.h [deleted file]

index c5e1b0d138bc738ed165d70548033a9de684cb37..17f78b71204ffc70fc968d6e6f41cb3d98ce7da6 100644 (file)
@@ -31,7 +31,7 @@ if(WITH_BLUESTORE)
     bluestore/fastbmap_allocator_impl.cc
     bluestore/FreelistManager.cc
     bluestore/StupidAllocator.cc
-    bluestore/BitmapFastAllocator.cc
+    bluestore/BitmapAllocator.cc
   )
 endif(WITH_BLUESTORE)
 
index 9b12301bac8cc91d5a7ba297ceb0af47665a076f..b6026353165cba9d1250aa85cff1dc65ca634603 100644 (file)
@@ -3,7 +3,7 @@
 
 #include "Allocator.h"
 #include "StupidAllocator.h"
-#include "BitmapFastAllocator.h"
+#include "BitmapAllocator.h"
 #include "common/debug.h"
 
 #define dout_subsys ceph_subsys_bluestore
@@ -14,7 +14,7 @@ Allocator *Allocator::create(CephContext* cct, string type,
   if (type == "stupid") {
     return new StupidAllocator(cct);
   } else if (type == "bitmap") {
-    return new BitmapFastAllocator(cct, size, block_size);
+    return new BitmapAllocator(cct, size, block_size);
   }
   lderr(cct) << "Allocator::" << __func__ << " unknown alloc type "
             << type << dendl;
diff --git a/src/os/bluestore/BitmapAllocator.cc b/src/os/bluestore/BitmapAllocator.cc
new file mode 100755 (executable)
index 0000000..fc7d66c
--- /dev/null
@@ -0,0 +1,85 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#include "BitmapAllocator.h"
+
+#define dout_context cct
+#define dout_subsys ceph_subsys_bluestore
+#undef dout_prefix
+#define dout_prefix *_dout << "fbmap_alloc 0x" << this << " "
+
+BitmapAllocator::BitmapAllocator(CephContext* _cct,
+                                        int64_t capacity,
+                                        int64_t alloc_unit) :
+    cct(_cct)
+{
+  ldout(cct, 10) << __func__ << " 0x" << std::hex << capacity << "/"
+                << alloc_unit << std::dec << dendl;
+  _init(capacity, alloc_unit, false);
+}
+
+int64_t BitmapAllocator::allocate(
+  uint64_t want_size, uint64_t alloc_unit, uint64_t max_alloc_size,
+  int64_t hint, PExtentVector *extents)
+{
+  uint64_t allocated = 0;
+
+  ldout(cct, 10) << __func__ << std::hex << "0x" << want_size
+                << "/" << alloc_unit << "," << max_alloc_size << "," << hint
+                << std::dec << dendl;
+    
+    
+  _allocate_l2(want_size, alloc_unit, max_alloc_size, hint,
+    &allocated, extents);
+  if (!allocated) {
+    return -ENOSPC;
+  }
+  for (auto e : *extents) {
+    ldout(cct, 10) << __func__
+                   << " 0x" << std::hex << e.offset << "~" << e.length
+                  << "/" << alloc_unit << "," << max_alloc_size << "," << hint
+                  << std::dec << dendl;
+  }
+  return int64_t(allocated);
+}
+
+void BitmapAllocator::release(
+  const interval_set<uint64_t>& release_set)
+{
+  for (auto r : release_set) {
+    ldout(cct, 10) << __func__ << " 0x" << std::hex << r.first << "~" << r.second
+                 << std::dec << dendl;
+  }
+  _free_l2(release_set);
+  ldout(cct, 10) << __func__ << " done" << dendl;
+}
+
+
+void BitmapAllocator::init_add_free(uint64_t offset, uint64_t length)
+{
+  ldout(cct, 10) << __func__ << " 0x" << std::hex << offset << "~" << length
+                 << std::dec << dendl;
+
+  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);
+  ldout(cct, 10) << __func__ << " done" << dendl;
+}
+void BitmapAllocator::init_rm_free(uint64_t offset, uint64_t length)
+{
+  ldout(cct, 10) << __func__ << " 0x" << std::hex << offset << "~" << length
+                << std::dec << dendl;
+  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);
+  ldout(cct, 10) << __func__ << " done" << dendl;
+}
+
+void BitmapAllocator::shutdown()
+{
+  ldout(cct, 1) << __func__ << dendl;
+  _shutdown();
+}
diff --git a/src/os/bluestore/BitmapAllocator.h b/src/os/bluestore/BitmapAllocator.h
new file mode 100755 (executable)
index 0000000..c4f7f7b
--- /dev/null
@@ -0,0 +1,48 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#ifndef CEPH_OS_BLUESTORE_BITMAPFASTALLOCATOR_H
+#define CEPH_OS_BLUESTORE_BITMAPFASTALLOCATOR_H
+
+#include <mutex>
+
+#include "Allocator.h"
+#include "os/bluestore/bluestore_types.h"
+#include "fastbmap_allocator_impl.h"
+#include "include/mempool.h"
+#include "common/debug.h"
+
+class BitmapAllocator : public Allocator,
+  public AllocatorLevel02<AllocatorLevel01Loose> {
+  CephContext* cct;
+
+public:
+  BitmapAllocator(CephContext* _cct, int64_t capacity, int64_t alloc_unit);
+  ~BitmapAllocator() override
+  {
+  }
+
+
+  int64_t allocate(
+    uint64_t want_size, uint64_t alloc_unit, uint64_t max_alloc_size,
+    int64_t hint, PExtentVector *extents) override;
+
+  void release(
+    const interval_set<uint64_t>& release_set) override;
+
+  uint64_t get_free() override
+  {
+    return get_available();
+  }
+
+  void dump() override
+  {
+  }
+
+  void init_add_free(uint64_t offset, uint64_t length) override;
+  void init_rm_free(uint64_t offset, uint64_t length) override;
+
+  void shutdown() override;
+};
+
+#endif
diff --git a/src/os/bluestore/BitmapFastAllocator.cc b/src/os/bluestore/BitmapFastAllocator.cc
deleted file mode 100755 (executable)
index 3180ca0..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab
-
-#include "BitmapFastAllocator.h"
-
-#define dout_context cct
-#define dout_subsys ceph_subsys_bluestore
-#undef dout_prefix
-#define dout_prefix *_dout << "fbmap_alloc 0x" << this << " "
-
-BitmapFastAllocator::BitmapFastAllocator(CephContext* _cct,
-                                        int64_t capacity,
-                                        int64_t alloc_unit) :
-    cct(_cct)
-{
-  ldout(cct, 10) << __func__ << " 0x" << std::hex << capacity << "/"
-                << alloc_unit << std::dec << dendl;
-  _init(capacity, alloc_unit, false);
-}
-
-int64_t BitmapFastAllocator::allocate(
-  uint64_t want_size, uint64_t alloc_unit, uint64_t max_alloc_size,
-  int64_t hint, PExtentVector *extents)
-{
-  uint64_t allocated = 0;
-
-  ldout(cct, 10) << __func__ << std::hex << "0x" << want_size
-                << "/" << alloc_unit << "," << max_alloc_size << "," << hint
-                << std::dec << dendl;
-    
-    
-  _allocate_l2(want_size, alloc_unit, max_alloc_size, hint,
-    &allocated, extents);
-  if (!allocated) {
-    return -ENOSPC;
-  }
-  for (auto e : *extents) {
-    ldout(cct, 10) << __func__
-                   << " 0x" << std::hex << e.offset << "~" << e.length
-                  << "/" << alloc_unit << "," << max_alloc_size << "," << hint
-                  << std::dec << dendl;
-  }
-  return int64_t(allocated);
-}
-
-void BitmapFastAllocator::release(
-  const interval_set<uint64_t>& release_set)
-{
-  for (auto r : release_set) {
-    ldout(cct, 10) << __func__ << " 0x" << std::hex << r.first << "~" << r.second
-                 << std::dec << dendl;
-  }
-  _free_l2(release_set);
-  ldout(cct, 10) << __func__ << " done" << dendl;
-}
-
-
-void BitmapFastAllocator::init_add_free(uint64_t offset, uint64_t length)
-{
-  ldout(cct, 10) << __func__ << " 0x" << std::hex << offset << "~" << length
-                 << std::dec << dendl;
-
-  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);
-  ldout(cct, 10) << __func__ << " done" << dendl;
-}
-void BitmapFastAllocator::init_rm_free(uint64_t offset, uint64_t length)
-{
-  ldout(cct, 10) << __func__ << " 0x" << std::hex << offset << "~" << length
-                << std::dec << dendl;
-  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);
-  ldout(cct, 10) << __func__ << " done" << dendl;
-}
-
-void BitmapFastAllocator::shutdown()
-{
-  ldout(cct, 1) << __func__ << dendl;
-  _shutdown();
-}
diff --git a/src/os/bluestore/BitmapFastAllocator.h b/src/os/bluestore/BitmapFastAllocator.h
deleted file mode 100755 (executable)
index 9807780..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
-// vim: ts=8 sw=2 smarttab
-
-#ifndef CEPH_OS_BLUESTORE_BITMAPFASTALLOCATOR_H
-#define CEPH_OS_BLUESTORE_BITMAPFASTALLOCATOR_H
-
-#include <mutex>
-
-#include "Allocator.h"
-#include "os/bluestore/bluestore_types.h"
-#include "fastbmap_allocator_impl.h"
-#include "include/mempool.h"
-#include "common/debug.h"
-
-class BitmapFastAllocator : public Allocator,
-  public AllocatorLevel02<AllocatorLevel01Loose> {
-  CephContext* cct;
-
-public:
-  BitmapFastAllocator(CephContext* _cct, int64_t capacity, int64_t alloc_unit);
-  ~BitmapFastAllocator() override
-  {
-  }
-
-
-  int64_t allocate(
-    uint64_t want_size, uint64_t alloc_unit, uint64_t max_alloc_size,
-    int64_t hint, PExtentVector *extents) override;
-
-  void release(
-    const interval_set<uint64_t>& release_set) override;
-
-  uint64_t get_free() override
-  {
-    return get_available();
-  }
-
-  void dump() override
-  {
-  }
-
-  void init_add_free(uint64_t offset, uint64_t length) override;
-  void init_rm_free(uint64_t offset, uint64_t length) override;
-
-  void shutdown() override;
-};
-
-#endif