Skip to content

Commit

Permalink
os/bluestore/FreelistManager: fix _dump locking
Browse files Browse the repository at this point in the history
Signed-off-by: Sage Weil <sage@redhat.com>
  • Loading branch information
liewegas committed Jan 14, 2016
1 parent 3a8c674 commit e92cbde
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/os/bluestore/FreelistManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ void FreelistManager::shutdown()
void FreelistManager::dump()
{
Mutex::Locker l(lock);
_dump();
}

void FreelistManager::_dump()
{
dout(30) << __func__ << " " << total_free
<< " in " << kv_free.size() << " extents" << dendl;
for (auto p = kv_free.begin();
Expand Down Expand Up @@ -121,7 +126,7 @@ int FreelistManager::allocate(
if (p != kv_free.end()) {
derr << " existing extent " << p->first << "~" << p->second << dendl;
}
dump();
_dump();
assert(0 == "bad allocate");
}

Expand Down Expand Up @@ -199,7 +204,7 @@ int FreelistManager::release(
} else if (p->first + p->second > offset) {
derr << __func__ << " bad release " << offset << "~" << length
<< " overlaps with " << p->first << "~" << p->second << dendl;
dump();
_dump();
assert(0 == "bad release overlap");
} else {
dout(30) << __func__ << " previous extent " << p->first << "~" << p->second
Expand All @@ -221,7 +226,7 @@ int FreelistManager::release(
} else if (p->first < offset + length) {
derr << __func__ << " bad release " << offset << "~" << length
<< " overlaps with " << p->first << "~" << p->second << dendl;
dump();
_dump();
assert(0 == "bad release overlap");
} else {
dout(30) << __func__ << " next extent " << p->first << "~" << p->second
Expand Down
1 change: 1 addition & 0 deletions src/os/bluestore/FreelistManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class FreelistManager {
std::map<uint64_t, uint64_t> kv_free; ///< mirrors our kv values in the db

void _audit();
void _dump();

public:
FreelistManager() :
Expand Down

0 comments on commit e92cbde

Please sign in to comment.