* 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);
return allocated;
}
+void BmapEntry::dump_state(int& count)
+{
+ dout(0) << count << ":: 0x" << std::hex << m_bits << dendl;
+}
+
/*
* Zone related functions.
*/
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.
*/
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
*/
alloc_assert(get_used_blocks() >= 0);
unlock();
}
+
+void BitAllocator::dump()
+{
+ int count = 0;
+ serial_lock();
+ dump_state(count);
+ serial_unlock();
+}
ExtentList *alloc_list, int64_t block_offset,
int64_t *scanned);
+ void dump_state(int& count);
~BmapEntry();
};
int64_t get_index();
int64_t get_level();
bmap_area_type_t get_type();
+ virtual void dump_state(int& count) = 0;
virtual ~BitMapArea() { }
};
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{
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{
BitAllocatorStats *get_stats() {
return m_stats;
}
+ void dump();
};
#endif //End of file
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;