From: Sage Weil Date: Tue, 6 Dec 2016 17:28:19 +0000 (-0500) Subject: os/bluestore: remove commit_{start,finish} from Allocator X-Git-Tag: v11.1.1~30^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5522dee83488f1185e0440ba93c7eb55dd247718;p=ceph.git os/bluestore: remove commit_{start,finish} from Allocator Signed-off-by: Sage Weil --- diff --git a/src/os/bluestore/Allocator.h b/src/os/bluestore/Allocator.h index 809debb2623d..13fe46b0eb17 100644 --- a/src/os/bluestore/Allocator.h +++ b/src/os/bluestore/Allocator.h @@ -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; diff --git a/src/os/bluestore/BitMapAllocator.cc b/src/os/bluestore/BitMapAllocator.cc index 138c5ae4d09d..7b0f3a8beb1e 100644 --- a/src/os/bluestore/BitMapAllocator.cc +++ b/src/os/bluestore/BitMapAllocator.cc @@ -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 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 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 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; -} diff --git a/src/os/bluestore/BitMapAllocator.h b/src/os/bluestore/BitMapAllocator.h index 9fe061ad3dcf..f885b73ca0ab 100644 --- a/src/os/bluestore/BitMapAllocator.h +++ b/src/os/bluestore/BitMapAllocator.h @@ -13,13 +13,9 @@ 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 m_uncommitted; ///< released but not yet usable - btree_interval_set 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; diff --git a/src/os/bluestore/StupidAllocator.cc b/src/os/bluestore/StupidAllocator.cc index f3cdadfaba29..64ab67c120b5 100644 --- a/src/os/bluestore/StupidAllocator.cc +++ b/src/os/bluestore/StupidAllocator.cc @@ -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 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 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; -} diff --git a/src/os/bluestore/StupidAllocator.h b/src/os/bluestore/StupidAllocator.h index 4f19197e7bde..cb694cb182cf 100644 --- a/src/os/bluestore/StupidAllocator.h +++ b/src/os/bluestore/StupidAllocator.h @@ -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 > free; ///< leading-edge copy - btree_interval_set uncommitted; ///< released but not yet usable - btree_interval_set 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;