]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: remove commit_{start,finish} from Allocator
authorSage Weil <sage@redhat.com>
Tue, 6 Dec 2016 17:28:19 +0000 (12:28 -0500)
committerSage Weil <sage@redhat.com>
Thu, 15 Dec 2016 19:20:28 +0000 (14:20 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/Allocator.h
src/os/bluestore/BitMapAllocator.cc
src/os/bluestore/BitMapAllocator.h
src/os/bluestore/StupidAllocator.cc
src/os/bluestore/StupidAllocator.h

index 809debb2623df8d05611efaafcfaa15db898711f..13fe46b0eb17f11b4a3cb98f7fa27b1c1b69f981 100644 (file)
@@ -62,9 +62,6 @@ public:
     return res;
   }
 
-  virtual void commit_start() = 0;
-  virtual void commit_finish() = 0;
-
   virtual void dump() = 0;
 
   virtual void init_add_free(uint64_t offset, uint64_t length) = 0;
index 138c5ae4d09de1607fcf3395e62c4428ccb40494..7b0f3a8beb1e8457829149e2664c8fb4195b5f98 100644 (file)
@@ -4,8 +4,6 @@
  * Bitmap based in-memory allocator.
  * Author: Ramesh Chander, Ramesh.Chander@sandisk.com
  *
- * TBD list:
- *  1. Make commiting and un commiting lists concurrent.
  */
 
 #include "BitAllocator.h"
@@ -20,8 +18,6 @@
 
 
 BitMapAllocator::BitMapAllocator(int64_t device_size, int64_t block_size)
-  : m_num_uncommitted(0),
-    m_num_committing(0)
 {
   assert(ISP2(block_size));
   if (!ISP2(block_size)) {
@@ -254,32 +250,8 @@ uint64_t BitMapAllocator::get_free()
 void BitMapAllocator::dump()
 {
   std::lock_guard<std::mutex> l(m_lock);
-
-  dout(0) << __func__ << " instance " << (uint64_t) this
-           << " Allocator Status dump : " << dendl;
-
+  dout(0) << __func__ << " instance " << this << dendl;
   m_bit_alloc->dump();
-  dout(0) << __func__ << " instance " << (uint64_t) this
-           << " committing: " << m_committing.num_intervals() << " extents"
-           << dendl;
-
-  for (auto p = m_committing.begin();
-    p != m_committing.end(); ++p) {
-    dout(0) << __func__ << " instance " << (uint64_t) this
-             << " 0x" << std::hex << p.get_start()
-             << "~" << p.get_len() << std::dec
-             << dendl;
-  }
-  dout(0) << __func__ << " instance " << (uint64_t) this
-           << " uncommitted: " << m_uncommitted.num_intervals() << " extents"
-           << dendl;
-
-  for (auto p = m_uncommitted.begin();
-    p != m_uncommitted.end(); ++p) {
-    dout(0) << __func__ << " 0x" << std::hex << p.get_start()
-             << "~" << p.get_len() << std::dec
-             << dendl;
-  }
 }
 
 void BitMapAllocator::init_add_free(uint64_t offset, uint64_t length)
@@ -332,32 +304,3 @@ void BitMapAllocator::shutdown()
   m_bit_alloc->shutdown();
 }
 
-void BitMapAllocator::commit_start()
-{
-  std::lock_guard<std::mutex> l(m_lock);
-
-  dout(10) << __func__ << " instance " << (uint64_t) this
-           << " releasing " << m_num_uncommitted
-           << " in extents " << m_uncommitted.num_intervals()
-           << dendl;
-  assert(m_committing.empty());
-  m_committing.swap(m_uncommitted);
-  m_num_committing = m_num_uncommitted;
-  m_num_uncommitted = 0;
-}
-
-void BitMapAllocator::commit_finish()
-{
-  std::lock_guard<std::mutex> l(m_lock);
-  dout(10) << __func__ << " instance " << (uint64_t) this
-           << " released " << m_num_committing
-           << " in extents " << m_committing.num_intervals()
-           << dendl;
-  for (auto p = m_committing.begin();
-    p != m_committing.end();
-    ++p) {
-    insert_free(p.get_start(), p.get_len());
-  }
-  m_committing.clear();
-  m_num_committing = 0;
-}
index 9fe061ad3dcf9a442d2ead98b54ca35dadd37002..f885b73ca0ab126090a46f592a45a109d1830880 100644 (file)
 class BitMapAllocator : public Allocator {
   std::mutex m_lock;
 
-  int64_t m_num_uncommitted;
-  int64_t m_num_committing;
   int64_t m_block_size;
   int64_t m_num_reserved;
 
-  btree_interval_set<uint64_t> m_uncommitted; ///< released but not yet usable
-  btree_interval_set<uint64_t> m_committing;  ///< released but not yet usable
   BitAllocator *m_bit_alloc; // Bit allocator instance
 
   void insert_free(uint64_t offset, uint64_t len);
@@ -49,9 +45,6 @@ public:
   int release(
     uint64_t offset, uint64_t length);
 
-  void commit_start();
-  void commit_finish();
-
   uint64_t get_free();
 
   void dump() override;
index f3cdadfaba29a65980dc2dccfd31d2cf3bafb85b..64ab67c120b5054bae4e9bdd49c334d9d10fa672 100644 (file)
@@ -11,8 +11,6 @@
 
 StupidAllocator::StupidAllocator()
   : num_free(0),
-    num_uncommitted(0),
-    num_committing(0),
     num_reserved(0),
     free(10),
     last_alloc(0)
@@ -274,22 +272,6 @@ void StupidAllocator::dump()
              << p.get_len() << std::dec << dendl;
     }
   }
-  dout(0) << __func__ << " committing: "
-         << committing.num_intervals() << " extents" << dendl;
-  for (auto p = committing.begin();
-       p != committing.end();
-       ++p) {
-    dout(0) << __func__ << "  0x" << std::hex << p.get_start() << "~"
-           << p.get_len() << std::dec << dendl;
-  }
-  dout(0) << __func__ << " uncommitted: "
-         << uncommitted.num_intervals() << " extents" << dendl;
-  for (auto p = uncommitted.begin();
-       p != uncommitted.end();
-       ++p) {
-    dout(0) << __func__ << "  0x" << std::hex << p.get_start() << "~"
-           << p.get_len() << std::dec << dendl;
-  }
 }
 
 void StupidAllocator::init_add_free(uint64_t offset, uint64_t length)
@@ -329,28 +311,3 @@ void StupidAllocator::shutdown()
   dout(1) << __func__ << dendl;
 }
 
-void StupidAllocator::commit_start()
-{
-  std::lock_guard<std::mutex> l(lock);
-  dout(10) << __func__ << " releasing " << num_uncommitted
-          << " in extents " << uncommitted.num_intervals() << dendl;
-  assert(committing.empty());
-  committing.swap(uncommitted);
-  num_committing = num_uncommitted;
-  num_uncommitted = 0;
-}
-
-void StupidAllocator::commit_finish()
-{
-  std::lock_guard<std::mutex> l(lock);
-  dout(10) << __func__ << " released " << num_committing
-          << " in extents " << committing.num_intervals() << dendl;
-  for (auto p = committing.begin();
-       p != committing.end();
-       ++p) {
-    _insert_free(p.get_start(), p.get_len());
-  }
-  committing.clear();
-  num_free += num_committing;
-  num_committing = 0;
-}
index 4f19197e7bde85a345313f8cfab5b3eeacc87bfb..cb694cb182cfc7f62a4dec78a8c18656de1e18cd 100644 (file)
@@ -14,13 +14,9 @@ class StupidAllocator : public Allocator {
   std::mutex lock;
 
   int64_t num_free;     ///< total bytes in freelist
-  int64_t num_uncommitted;
-  int64_t num_committing;
   int64_t num_reserved; ///< reserved bytes
 
   std::vector<btree_interval_set<uint64_t> > free;        ///< leading-edge copy
-  btree_interval_set<uint64_t> uncommitted; ///< released but not yet usable
-  btree_interval_set<uint64_t> committing;  ///< released but not yet usable
 
   uint64_t last_alloc;
 
@@ -45,9 +41,6 @@ public:
   int release(
     uint64_t offset, uint64_t length);
 
-  void commit_start();
-  void commit_finish();
-
   uint64_t get_free();
 
   void dump() override;