mirror of
https://github.com/ceph/ceph
synced 2025-01-21 02:31:19 +00:00
os/bluestore: simplify SharedBlob::put_ref interface
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
This commit is contained in:
parent
b06dd3bb0a
commit
072af9043b
@ -1691,14 +1691,11 @@ void BlueStore::SharedBlob::get_ref(uint64_t offset, uint32_t length)
|
||||
|
||||
void BlueStore::SharedBlob::put_ref(uint64_t offset, uint32_t length,
|
||||
PExtentVector *r,
|
||||
set<SharedBlob*> *maybe_unshared)
|
||||
bool *unshare)
|
||||
{
|
||||
assert(persistent);
|
||||
bool maybe = false;
|
||||
persistent->ref_map.put(offset, length, r, maybe_unshared ? &maybe : nullptr);
|
||||
if (maybe_unshared && maybe) {
|
||||
maybe_unshared->insert(this);
|
||||
}
|
||||
persistent->ref_map.put(offset, length, r,
|
||||
unshare && !*unshare ? unshare : nullptr);
|
||||
}
|
||||
|
||||
// SharedBlobSet
|
||||
@ -10267,10 +10264,17 @@ void BlueStore::_wctx_finish(
|
||||
if (blob.is_shared()) {
|
||||
PExtentVector final;
|
||||
c->load_shared_blob(b->shared_blob);
|
||||
bool unshare = false;
|
||||
bool* unshare_ptr =
|
||||
!maybe_unshared_blobs || b->is_referenced() ? nullptr : &unshare;
|
||||
for (auto e : r) {
|
||||
b->shared_blob->put_ref(
|
||||
e.offset, e.length, &final,
|
||||
b->is_referenced() ? nullptr : maybe_unshared_blobs);
|
||||
unshare_ptr);
|
||||
}
|
||||
if (unshare) {
|
||||
assert(maybe_unshared_blobs);
|
||||
maybe_unshared_blobs->insert(b->shared_blob.get());
|
||||
}
|
||||
dout(20) << __func__ << " shared_blob release " << final
|
||||
<< " from " << *b->shared_blob << dendl;
|
||||
|
@ -402,7 +402,7 @@ public:
|
||||
|
||||
/// put logical references, and get back any released extents
|
||||
void put_ref(uint64_t offset, uint32_t length,
|
||||
PExtentVector *r, set<SharedBlob*> *maybe_unshared_blobs);
|
||||
PExtentVector *r, bool *unshare);
|
||||
|
||||
friend bool operator==(const SharedBlob &l, const SharedBlob &r) {
|
||||
return l.get_sbid() == r.get_sbid();
|
||||
|
Loading…
Reference in New Issue
Block a user