if (ep->blob->last_encoded_id == -1) {
const bluestore_blob_t& blob = ep->blob->get_blob();
if (blob.is_shared()) {
- // excellent time to load the blob
- c->load_shared_blob(ep->blob->shared_blob);
- if (!blob.is_compressed()) {
- // Restrict elastic shared blobs to non-compressed blobs.
- // Fsck cannot handle case when one shared blob contains refs to
- // both shared and non-shared blobs.
+ // excellent time to load the blob
+ c->load_shared_blob(ep->blob->get_shared_blob());
+ if (!blob.is_compressed()) {
+ // Restrict elastic shared blobs to non-compressed blobs.
+ // Fsck cannot handle case when one shared blob contains refs to
+ // both shared and non-shared blobs.
// todo consider change to emplace_hint
candidates.emplace(ep->blob_start(), ep->blob.get());
uint32_t b_logical_length = b->merge_blob(store->cct, e.blob.get());
for (auto p : blob.get_extents()) {
if (p.is_valid()) {
- b->shared_blob->get_ref(p.offset, p.length);
+ b->get_shared_blob()->get_ref(p.offset, p.length);
}
}
// reblob extents might erase e
++ep;
}
} else {
- c->load_shared_blob(e.blob->shared_blob);
+ c->load_shared_blob(e.blob->get_shared_blob());
++ep;
}
}
// -1 to exclude next potential shard
dirty_range_end = e.logical_end() - 1;
} else {
- c->load_shared_blob(e.blob->shared_blob);
+ c->load_shared_blob(e.blob->get_shared_blob());
}
cb = c->new_blob();
e.blob->last_encoded_id = n;
// bump the extent refs on the copied blob's extents
for (auto p : blob.get_extents()) {
if (p.is_valid()) {
- e.blob->shared_blob->get_ref(p.offset, p.length);
+ e.blob->get_shared_blob()->get_ref(p.offset, p.length);
}
}
- txc->write_shared_blob(e.blob->shared_blob);
+ txc->write_shared_blob(e.blob->get_shared_blob());
dout(20) << __func__ << " new " << *cb << dendl;
}
// we must copy source blob diligently region-by-region
// initialize shared_blob
cb->dirty_blob().set_flag(bluestore_blob_t::FLAG_SHARED);
- cb->set_shared_blob(e.blob->shared_blob);
+ cb->set_shared_blob(e.blob->get_shared_blob());
}
// By default do not copy buffers to clones, and let them read data by themselves.
// The exception are 'writing' buffers, which are not yet stable on device.
txc->blobs_written.insert(cb);
}
- txc->write_shared_blob(e.blob->shared_blob);
+ txc->write_shared_blob(e.blob->get_shared_blob());
dout(20) << __func__ << " new " << *cb << dendl;
}
bluestore_extent_ref_map_t* ref_map = nullptr;
if (bblob.is_shared()) {
ceph_assert(ep->blob->is_shared_loaded());
- bluestore_shared_blob_t* bsblob = ep->blob->shared_blob->persistent;
+ bluestore_shared_blob_t* bsblob = ep->blob->get_shared_blob()->persistent;
ref_map = &bsblob->ref_map;
}
void BlueStore::Collection::open_shared_blob(uint64_t sbid, BlobRef b)
{
- ceph_assert(!b->shared_blob);
+ ceph_assert(!b->get_shared_blob());
const bluestore_blob_t& blob = b->get_blob();
if (!blob.is_shared()) {
return;
if (sb) {
b->set_shared_blob(sb);
ldout(store->cct, 10) << __func__ << " sbid 0x" << std::hex << sbid
- << std::dec << " had " << *b->shared_blob << dendl;
+ << std::dec << " had " << *b->get_shared_blob() << dendl;
} else {
b->set_shared_blob(new SharedBlob(sbid, this));
- shared_blob_set.add(this, b->shared_blob.get());
+ shared_blob_set.add(this, b->get_shared_blob().get());
ldout(store->cct, 10) << __func__ << " sbid 0x" << std::hex << sbid
- << std::dec << " opened " << *b->shared_blob
+ << std::dec << " opened " << *b->get_shared_blob()
<< dendl;
}
}
blob.clear_flag(bluestore_blob_t::FLAG_HAS_UNUSED);
// update shared blob
b->set_shared_blob(new SharedBlob(sbid, this));
- b->shared_blob->loaded = true;
- b->shared_blob->persistent = new bluestore_shared_blob_t(sbid);
- shared_blob_set.add(this, b->shared_blob.get());
+ b->get_shared_blob()->loaded = true;
+ b->get_shared_blob()->persistent = new bluestore_shared_blob_t(sbid);
+ shared_blob_set.add(this, b->get_shared_blob().get());
for (auto p : blob.get_extents()) {
if (p.is_valid()) {
- b->shared_blob->get_ref(
+ b->get_shared_blob()->get_ref(
p.offset,
p.length);
}
}
cache->rm_blob();
dest->cache->add_blob();
- SharedBlob* sb = b->shared_blob.get();
+ SharedBlob* sb = b->get_shared_blob().get();
b->collection = dest;
if (sb) {
if (sb->collection == dest) {
dout(20) << __func__ << " blob " << *b << " release " << r << dendl;
if (blob.is_shared()) {
PExtentVector final;
- c->load_shared_blob(b->shared_blob);
+ c->load_shared_blob(b->get_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(
+ b->get_shared_blob()->put_ref(
e.offset, e.length, &final,
unshare_ptr);
}
if (unshare) {
ceph_assert(maybe_unshared_blobs);
- maybe_unshared_blobs->insert(b->shared_blob.get());
+ maybe_unshared_blobs->insert(b->get_shared_blob().get());
}
dout(20) << __func__ << " shared_blob release " << final
- << " from " << *b->shared_blob << dendl;
- txc->write_shared_blob(b->shared_blob);
+ << " from " << *b->get_shared_blob() << dendl;
+ txc->write_shared_blob(b->get_shared_blob());
r.clear();
r.swap(final);
}
map<SharedBlob*,bluestore_extent_ref_map_t> expect;
for (auto& e : h->extent_map.extent_map) {
const bluestore_blob_t& b = e.blob->get_blob();
- SharedBlob *sb = e.blob->shared_blob.get();
+ SharedBlob *sb = e.blob->get_shared_blob().get();
if (b.is_shared() &&
sb->loaded &&
maybe_unshared_blobs.count(sb)) {
// And now a run through .head extents to clear up freshly unshared blobs.
for (auto& e : h->extent_map.extent_map) {
const bluestore_blob_t& b = e.blob->get_blob();
- SharedBlob *sb = e.blob->shared_blob.get();
+ SharedBlob *sb = e.blob->get_shared_blob().get();
if (b.is_shared() &&
std::find(unshared_blobs.begin(), unshared_blobs.end(),
sb) != unshared_blobs.end()) {
dout(20) << __func__ << " unsharing " << e << dendl;
bluestore_blob_t& blob = e.blob->dirty_blob();
blob.clear_flag(bluestore_blob_t::FLAG_SHARED);
- if (e.blob->shared_blob->nref > 1) {
+ if (e.blob->get_shared_blob()->nref > 1) {
// Each blob on creation gets its own unique (empty) shared_blob.
// In function ExtentMap::dup() we sometimes merge 2 blobs,
// so they share common shared_blob used for ref counting.
// Here we skip set_shared_blob() because e.blob is already in BufferCacheShard
// and cannot do add_blob() twice
- e.blob->shared_blob = new SharedBlob(c.get());
+ e.blob->get_dirty_shared_blob() = new SharedBlob(c.get());
}
h->extent_map.dirty_range(e.logical_offset, 1);
}