mirror of
https://github.com/ceph/ceph
synced 2024-12-30 15:33:31 +00:00
unittest_bit_alloc race fix
Signed-off-by: Ramesh Chander <Ramesh.Chander@sandisk.com> Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
2b2ab914b2
commit
506a06a71e
@ -827,6 +827,12 @@ int64_t BitMapAreaIN::get_used_blocks()
|
||||
return m_used_blocks;
|
||||
}
|
||||
|
||||
int64_t BitMapAreaIN::get_used_blocks_adj()
|
||||
{
|
||||
std::lock_guard<std::mutex> l(m_blocks_lock);
|
||||
return m_used_blocks - m_reserved_blocks;
|
||||
}
|
||||
|
||||
bool BitMapAreaIN::reserve_blocks(int64_t num)
|
||||
{
|
||||
bool res = false;
|
||||
|
@ -416,6 +416,7 @@ public:
|
||||
virtual void unreserve(int64_t num_blocks, int64_t allocated);
|
||||
virtual int64_t get_reserved_blocks();
|
||||
virtual int64_t get_used_blocks();
|
||||
virtual int64_t get_used_blocks_adj();
|
||||
virtual int64_t size() {
|
||||
return m_total_blocks;
|
||||
}
|
||||
@ -530,7 +531,7 @@ public:
|
||||
return m_total_blocks - m_extra_blocks;
|
||||
}
|
||||
int64_t get_used_blocks() {
|
||||
return BitMapAreaIN::get_used_blocks() - (m_extra_blocks + m_reserved_blocks);
|
||||
return (BitMapAreaIN::get_used_blocks_adj() - m_extra_blocks);
|
||||
}
|
||||
|
||||
BitAllocatorStats *get_stats() {
|
||||
|
Loading…
Reference in New Issue
Block a user