Skip to content

Commit

Permalink
Merge pull request #12282 from liewegas/wip-bluestore-dump
Browse files Browse the repository at this point in the history
os/bluestore: clean up Allocator::dump
  • Loading branch information
varadakari committed Dec 3, 2016
2 parents 263cbc2 + 462110a commit 177bae7
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/os/bluestore/Allocator.h
Expand Up @@ -65,7 +65,7 @@ class Allocator {
virtual void commit_start() = 0;
virtual void commit_finish() = 0;

virtual void dump(std::ostream& out) = 0;
virtual void dump() = 0;

virtual void init_add_free(uint64_t offset, uint64_t length) = 0;
virtual void init_rm_free(uint64_t offset, uint64_t length) = 0;
Expand Down
10 changes: 5 additions & 5 deletions src/os/bluestore/BitMapAllocator.cc
Expand Up @@ -252,27 +252,27 @@ uint64_t BitMapAllocator::get_free()
m_block_size);
}

void BitMapAllocator::dump(ostream& out)
void BitMapAllocator::dump()
{
std::lock_guard<std::mutex> l(m_lock);
dout(30) << __func__ << " instance " << (uint64_t) this
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(30) << __func__ << " instance " << (uint64_t) this
dout(0) << __func__ << " instance " << (uint64_t) this
<< " 0x" << std::hex << p.get_start()
<< "~" << p.get_len() << std::dec
<< dendl;
}
dout(30) << __func__ << " instance " << (uint64_t) this
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(30) << __func__ << " 0x" << std::hex << p.get_start()
dout(0) << __func__ << " 0x" << std::hex << p.get_start()
<< "~" << p.get_len() << std::dec
<< dendl;
}
Expand Down
2 changes: 1 addition & 1 deletion src/os/bluestore/BitMapAllocator.h
Expand Up @@ -54,7 +54,7 @@ class BitMapAllocator : public Allocator {

uint64_t get_free();

void dump(std::ostream& out);
void dump() override;

void init_add_free(uint64_t offset, uint64_t length);
void init_rm_free(uint64_t offset, uint64_t length);
Expand Down
3 changes: 3 additions & 0 deletions src/os/bluestore/BlueFS.cc
Expand Up @@ -1754,6 +1754,9 @@ int BlueFS::_allocate(uint8_t id, uint64_t len,
r = alloc[id]->alloc_extents(left, min_alloc_size,
hint, &extents, &count);
if (r < 0) {
derr << __func__ << " allocate failed on 0x" << std::hex << left
<< " min_alloc_size 0x" << min_alloc_size << std::dec << dendl;
alloc[id]->dump();
assert(0 == "allocate failed... wtf");
return r;
}
Expand Down
3 changes: 3 additions & 0 deletions src/os/bluestore/BlueStore.cc
Expand Up @@ -3573,6 +3573,9 @@ int BlueStore::_balance_bluefs_freespace(vector<bluestore_pextent_t> *extents)
uint32_t elength;
r = alloc->allocate(gift, min_alloc_size, hint, &eoffset, &elength);
if (r < 0) {
derr << __func__ << " allocate failed on 0x" << std::hex << gift
<< " min_alloc_size 0x" << min_alloc_size << std::dec << dendl;
alloc->dump();
assert(0 == "allocate failed, wtf");
return r;
}
Expand Down
26 changes: 13 additions & 13 deletions src/os/bluestore/StupidAllocator.cc
Expand Up @@ -261,34 +261,34 @@ uint64_t StupidAllocator::get_free()
return num_free;
}

void StupidAllocator::dump(ostream& out)
void StupidAllocator::dump()
{
std::lock_guard<std::mutex> l(lock);
for (unsigned bin = 0; bin < free.size(); ++bin) {
dout(30) << __func__ << " free bin " << bin << ": "
<< free[bin].num_intervals() << " extents" << dendl;
dout(0) << __func__ << " free bin " << bin << ": "
<< free[bin].num_intervals() << " extents" << dendl;
for (auto p = free[bin].begin();
p != free[bin].end();
++p) {
dout(30) << __func__ << " 0x" << std::hex << p.get_start() << "~"
<< p.get_len() << std::dec << dendl;
dout(0) << __func__ << " 0x" << std::hex << p.get_start() << "~"
<< p.get_len() << std::dec << dendl;
}
}
dout(30) << __func__ << " committing: "
<< committing.num_intervals() << " extents" << dendl;
dout(0) << __func__ << " committing: "
<< committing.num_intervals() << " extents" << dendl;
for (auto p = committing.begin();
p != committing.end();
++p) {
dout(30) << __func__ << " 0x" << std::hex << p.get_start() << "~"
<< p.get_len() << std::dec << dendl;
dout(0) << __func__ << " 0x" << std::hex << p.get_start() << "~"
<< p.get_len() << std::dec << dendl;
}
dout(30) << __func__ << " uncommitted: "
<< uncommitted.num_intervals() << " extents" << dendl;
dout(0) << __func__ << " uncommitted: "
<< uncommitted.num_intervals() << " extents" << dendl;
for (auto p = uncommitted.begin();
p != uncommitted.end();
++p) {
dout(30) << __func__ << " 0x" << std::hex << p.get_start() << "~"
<< p.get_len() << std::dec << dendl;
dout(0) << __func__ << " 0x" << std::hex << p.get_start() << "~"
<< p.get_len() << std::dec << dendl;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/os/bluestore/StupidAllocator.h
Expand Up @@ -50,7 +50,7 @@ class StupidAllocator : public Allocator {

uint64_t get_free();

void dump(std::ostream& out);
void dump() override;

void init_add_free(uint64_t offset, uint64_t length);
void init_rm_free(uint64_t offset, uint64_t length);
Expand Down

0 comments on commit 177bae7

Please sign in to comment.