Signed-off-by: Sage Weil <sage@redhat.com>
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) {
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(); }