mirror of
https://github.com/ceph/ceph
synced 2025-03-11 02:39:05 +00:00
os/bluestore: clear SharedBlob cache in dtor
Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
fa0f411029
commit
cdde7b6ad7
@ -1177,6 +1177,21 @@ ostream& operator<<(ostream& out, const BlueStore::SharedBlob& sb)
|
||||
return out << ")";
|
||||
}
|
||||
|
||||
BlueStore::SharedBlob::SharedBlob(uint64_t i, const string& k, Cache *c)
|
||||
: sbid(i),
|
||||
key(k),
|
||||
bc(c)
|
||||
{
|
||||
}
|
||||
|
||||
BlueStore::SharedBlob::~SharedBlob()
|
||||
{
|
||||
if (bc.cache) { // the dummy instances have a nullptr
|
||||
std::lock_guard<std::recursive_mutex> l(bc.cache->lock);
|
||||
bc._clear();
|
||||
}
|
||||
}
|
||||
|
||||
void BlueStore::SharedBlob::put()
|
||||
{
|
||||
if (--nref == 0) {
|
||||
|
@ -314,10 +314,8 @@ public:
|
||||
|
||||
BufferSpace bc; ///< buffer cache
|
||||
|
||||
SharedBlob(uint64_t i, const string& k, Cache *c) : sbid(i), key(k), bc(c) {}
|
||||
~SharedBlob() {
|
||||
assert(bc.empty());
|
||||
}
|
||||
SharedBlob(uint64_t i, const string& k, Cache *c);
|
||||
~SharedBlob();
|
||||
|
||||
friend void intrusive_ptr_add_ref(SharedBlob *b) { b->get(); }
|
||||
friend void intrusive_ptr_release(SharedBlob *b) { b->put(); }
|
||||
|
Loading…
Reference in New Issue
Block a user