mirror of
https://github.com/ceph/ceph
synced 2025-01-04 02:02:36 +00:00
bitmap allocator dump functionality
Signed-off-by: Ramesh Chander <Ramesh.Chander@sandisk.com>
This commit is contained in:
parent
55df834e85
commit
d89df9dfe8
@ -18,11 +18,16 @@
|
||||
* of the interfaces defined in BitMapArea.
|
||||
*/
|
||||
|
||||
#include "common/dout.h"
|
||||
#include "BitAllocator.h"
|
||||
#include <assert.h>
|
||||
#include "bluestore_types.h"
|
||||
#include "common/debug.h"
|
||||
#include <math.h>
|
||||
|
||||
#define dout_subsys ceph_subsys_bluestore
|
||||
#undef dout_prefix
|
||||
#define dout_prefix *_dout << "bitalloc:"
|
||||
|
||||
MEMPOOL_DEFINE_OBJECT_FACTORY(BitMapArea, BitMapArea, bluestore_alloc);
|
||||
MEMPOOL_DEFINE_OBJECT_FACTORY(BitMapAreaIN, BitMapAreaIN, bluestore_alloc);
|
||||
MEMPOOL_DEFINE_OBJECT_FACTORY(BitMapAreaLeaf, BitMapAreaLeaf, bluestore_alloc);
|
||||
@ -340,6 +345,11 @@ int BmapEntry::find_any_free_bits(int start_offset, int64_t num_blocks,
|
||||
return allocated;
|
||||
}
|
||||
|
||||
void BmapEntry::dump_state(int& count)
|
||||
{
|
||||
dout(0) << count << ":: 0x" << std::hex << m_bits << dendl;
|
||||
}
|
||||
|
||||
/*
|
||||
* Zone related functions.
|
||||
*/
|
||||
@ -631,6 +641,22 @@ int64_t BitMapZone::alloc_blocks_dis(int64_t num_blocks,
|
||||
return allocated;
|
||||
}
|
||||
|
||||
void BitMapZone::dump_state(int& count)
|
||||
{
|
||||
BmapEntry *bmap = NULL;
|
||||
int bmap_idx = 0;
|
||||
BitMapEntityIter <BmapEntry> iter = BitMapEntityIter<BmapEntry>(
|
||||
m_bmap_list, 0);
|
||||
dout(0) << __func__ << " zone " << count << " dump start " << dendl;
|
||||
while ((bmap = (BmapEntry *) iter.next())) {
|
||||
bmap->dump_state(bmap_idx);
|
||||
bmap_idx++;
|
||||
}
|
||||
dout(0) << __func__ << " zone " << count << " dump end " << dendl;
|
||||
count++;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* BitMapArea Leaf and non-Leaf functions.
|
||||
*/
|
||||
@ -1060,6 +1086,18 @@ void BitMapAreaIN::free_blocks(int64_t start_block, int64_t num_blocks)
|
||||
unlock();
|
||||
}
|
||||
|
||||
void BitMapAreaIN::dump_state(int& count)
|
||||
{
|
||||
BitMapArea *child = NULL;
|
||||
|
||||
BmapEntityListIter iter = BmapEntityListIter(
|
||||
m_child_list, 0, false);
|
||||
|
||||
while ((child = (BitMapArea *) iter.next())) {
|
||||
child->dump_state(count);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* BitMapArea Leaf
|
||||
*/
|
||||
@ -1669,3 +1707,11 @@ void BitAllocator::free_blocks_dis(int64_t num_blocks, ExtentList *block_list)
|
||||
alloc_assert(get_used_blocks() >= 0);
|
||||
unlock();
|
||||
}
|
||||
|
||||
void BitAllocator::dump()
|
||||
{
|
||||
int count = 0;
|
||||
serial_lock();
|
||||
dump_state(count);
|
||||
serial_unlock();
|
||||
}
|
||||
|
@ -180,6 +180,7 @@ public:
|
||||
ExtentList *alloc_list, int64_t block_offset,
|
||||
int64_t *scanned);
|
||||
|
||||
void dump_state(int& count);
|
||||
~BmapEntry();
|
||||
|
||||
};
|
||||
@ -264,6 +265,7 @@ public:
|
||||
int64_t get_index();
|
||||
int64_t get_level();
|
||||
bmap_area_type_t get_type();
|
||||
virtual void dump_state(int& count) = 0;
|
||||
virtual ~BitMapArea() { }
|
||||
};
|
||||
|
||||
@ -381,6 +383,7 @@ public:
|
||||
void set_blocks_used(int64_t start_block, int64_t num_blocks);
|
||||
|
||||
void free_blocks(int64_t start_block, int64_t num_blocks);
|
||||
void dump_state(int& count);
|
||||
};
|
||||
|
||||
class BitMapAreaIN: public BitMapArea{
|
||||
@ -457,6 +460,7 @@ public:
|
||||
|
||||
virtual void free_blocks_int(int64_t start_block, int64_t num_blocks);
|
||||
virtual void free_blocks(int64_t start_block, int64_t num_blocks);
|
||||
void dump_state(int& count);
|
||||
};
|
||||
|
||||
class BitMapAreaLeaf: public BitMapAreaIN{
|
||||
@ -562,6 +566,7 @@ public:
|
||||
BitAllocatorStats *get_stats() {
|
||||
return m_stats;
|
||||
}
|
||||
void dump();
|
||||
};
|
||||
|
||||
#endif //End of file
|
||||
|
@ -255,6 +255,11 @@ 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;
|
||||
|
||||
m_bit_alloc->dump();
|
||||
dout(0) << __func__ << " instance " << (uint64_t) this
|
||||
<< " committing: " << m_committing.num_intervals() << " extents"
|
||||
<< dendl;
|
||||
|
Loading…
Reference in New Issue
Block a user