mirror of
https://github.com/ceph/ceph
synced 2025-02-19 00:47:49 +00:00
Merge pull request #22123 from liewegas/wip-24211
os/bluestore: simplify and fix SharedBlob::put() Reviewed-by: Radoslaw Zarzynski <rzarzyns@redhat.com> Reviewed-by: Adam Kupczyk <akupczyk@redhat.com>
This commit is contained in:
commit
6d30a32922
@ -1672,16 +1672,9 @@ void BlueStore::SharedBlob::put()
|
||||
<< " removing self from set " << get_parent()
|
||||
<< dendl;
|
||||
if (get_parent()) {
|
||||
if (get_parent()->try_remove(this)) {
|
||||
delete this;
|
||||
} else {
|
||||
ldout(coll->store->cct, 20)
|
||||
<< __func__ << " " << this << " lost race to remove myself from set"
|
||||
<< dendl;
|
||||
}
|
||||
} else {
|
||||
delete this;
|
||||
get_parent()->remove_last(this);
|
||||
}
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -437,7 +437,8 @@ public:
|
||||
SharedBlobRef lookup(uint64_t sbid) {
|
||||
std::lock_guard<std::mutex> l(lock);
|
||||
auto p = sb_map.find(sbid);
|
||||
if (p == sb_map.end()) {
|
||||
if (p == sb_map.end() ||
|
||||
p->second->nref == 0) {
|
||||
return nullptr;
|
||||
}
|
||||
return p->second;
|
||||
@ -449,14 +450,11 @@ public:
|
||||
sb->coll = coll;
|
||||
}
|
||||
|
||||
bool try_remove(SharedBlob *sb) {
|
||||
void remove_last(SharedBlob *sb) {
|
||||
std::lock_guard<std::mutex> l(lock);
|
||||
if (sb->nref == 0) {
|
||||
assert(sb->get_parent() == this);
|
||||
sb_map.erase(sb->get_sbid());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
assert(sb->nref == 0);
|
||||
assert(sb->get_parent() == this);
|
||||
sb_map.erase(sb->get_sbid());
|
||||
}
|
||||
|
||||
void remove(SharedBlob *sb) {
|
||||
|
Loading…
Reference in New Issue
Block a user