coll_cache->rm_blob();
}
SharedBlob* sb = shared_blob.get();
- if (!sb) {
- ceph_assert(bc.buffer_map.empty());
- return;
- }
+ ceph_assert(sb || (!sb && bc.buffer_map.empty()));
}
void BlueStore::Blob::dump(Formatter* f) const
// dup the blob
const bluestore_blob_t& blob = e.blob->get_blob();
ceph_assert(blob.is_shared());
- ceph_assert(e.blob->is_loaded());
+ ceph_assert(e.blob->is_shared_loaded());
ceph_assert(!blob.has_unused());
cb = c->new_blob();
e.blob->last_encoded_id = n;
unsigned n;
denc_varint(n, p);
while (n--) {
- BlueStore::BlobRef b(c->new_blob());
+ BlueStore::BlobRef b = c->new_blob();
denc_varint(b->id, p);
uint64_t sbid = 0;
b->decode(p, struct_v, &sbid, true, c);
bluestore_extent_ref_map_t* ref_map = nullptr;
if (bblob.is_shared()) {
- ceph_assert(ep->blob->is_loaded());
+ ceph_assert(ep->blob->is_shared_loaded());
bluestore_shared_blob_t* bsblob = ep->blob->shared_blob->persistent;
ref_map = &bsblob->ref_map;
}
ceph_assert(!b->shared_blob);
const bluestore_blob_t& blob = b->get_blob();
if (!blob.is_shared()) {
- b->collection = this;
return;
}
void BlueStore::Collection::make_blob_shared(uint64_t sbid, BlobRef b)
{
ldout(store->cct, 10) << __func__ << " " << *b << dendl;
- ceph_assert(!b->is_loaded());
- ceph_assert(!b->shared_blob);
// update blob
bluestore_blob_t& blob = b->dirty_blob();
// drop any unused parts, unlikely we could use them in future
blob.clear_flag(bluestore_blob_t::FLAG_HAS_UNUSED);
// update shared blob
- b->shared_blob = new SharedBlob(sbid, this);
+ 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());
dest->cache->add_blob();
SharedBlob* sb = b->shared_blob.get();
b->collection = dest;
- if (sb && sb->collection == dest) {
- ldout(store->cct, 20) << __func__ << " already moved " << *sb
- << dendl;
- return;
- }
- ldout(store->cct, 20) << __func__ << " moving " << *b << dendl;
- if (b->get_sbid()) {
- ldout(store->cct, 20) << __func__ << " moving " << *sb << dendl;
- ldout(store->cct, 20) << __func__
- << " moving registration " << *sb << dendl;
- shared_blob_set.remove(sb);
- dest->shared_blob_set.add(dest, sb);
- }
if (sb) {
+ if (sb->collection == dest) {
+ ldout(store->cct, 20) << __func__ << " already moved " << *sb
+ << dendl;
+ return;
+ }
+ ldout(store->cct, 20) << __func__ << " moving " << *b << dendl;
+ ldout(store->cct, 20) << __func__ << " moving " << *sb << dendl;
+ shared_blob_set.remove(sb);
+ dest->shared_blob_set.add(dest, sb);
sb->collection = dest;
}
};
g_ceph_context, "lru", NULL);
auto coll = ceph::make_ref<BlueStore::Collection>(&store, oc, bc, coll_t());
- BlueStore::Blob b;
- b.collection = coll;
+ BlueStore::Blob b(coll.get());
b.set_shared_blob(new BlueStore::SharedBlob(coll.get()));
b.dirty_blob().allocated_test(bluestore_pextent_t(0x40715000, 0x2000));
b.dirty_blob().allocated_test(
auto coll = ceph::make_ref<BlueStore::Collection>(&store, oc, bc, coll_t());
{
- BlueStore::Blob B;
- B.collection = coll;
+ BlueStore::Blob B(coll.get());
B.set_shared_blob(new BlueStore::SharedBlob(coll.get()));
bluestore_blob_t& b = B.dirty_blob();
PExtentVector r;
ASSERT_EQ(mas*2, b.get_extents()[0].length);
}
{
- BlueStore::Blob B;
- B.collection = coll;
+ BlueStore::Blob B(coll.get());
B.set_shared_blob(new BlueStore::SharedBlob(coll.get()));
bluestore_blob_t& b = B.dirty_blob();
PExtentVector r;
ASSERT_EQ(mas*2, b.get_extents()[0].length);
}
{
- BlueStore::Blob B;
- B.collection = coll;
+ BlueStore::Blob B(coll.get());
B.set_shared_blob(new BlueStore::SharedBlob(coll.get()));
bluestore_blob_t& b = B.dirty_blob();
PExtentVector r;
ASSERT_EQ(3u, b.get_extents().size());
}
{
- BlueStore::Blob B;
- B.collection = coll;
+ BlueStore::Blob B(coll.get());
B.set_shared_blob(new BlueStore::SharedBlob(coll.get()));
bluestore_blob_t& b = B.dirty_blob();
PExtentVector r;
ASSERT_TRUE(b.get_extents()[4].is_valid());
}
{
- BlueStore::Blob B;
- B.collection = coll;
+ BlueStore::Blob B(coll);
B.set_shared_blob(new BlueStore::SharedBlob(coll.get()));
bluestore_blob_t& b = B.dirty_blob();
PExtentVector r;
ASSERT_TRUE(b.get_extents()[2].is_valid());
}
{
- BlueStore::Blob B;
- B.collection = coll;
+ BlueStore::Blob B(coll);
B.set_shared_blob(new BlueStore::SharedBlob(coll.get()));
bluestore_blob_t& b = B.dirty_blob();
PExtentVector r;
ASSERT_TRUE(b.get_extents()[2].is_valid());
}
{
- BlueStore::Blob B;
- B.collection = coll;
+ BlueStore::Blob B(coll);
B.set_shared_blob(new BlueStore::SharedBlob(coll.get()));
bluestore_blob_t& b = B.dirty_blob();
PExtentVector r;
ASSERT_FALSE(b.get_extents()[0].is_valid());
}
{
- BlueStore::Blob B;
- B.collection = coll;
+ BlueStore::Blob B(coll);
B.set_shared_blob(new BlueStore::SharedBlob(coll.get()));
bluestore_blob_t& b = B.dirty_blob();
PExtentVector r;
ASSERT_FALSE(b.get_extents()[0].is_valid());
}
{
- BlueStore::Blob B;
- B.collection = coll;
+ BlueStore::Blob B(coll.get());
B.set_shared_blob(new BlueStore::SharedBlob(coll.get()));
bluestore_blob_t& b = B.dirty_blob();
PExtentVector r;
}
// verify csum chunk size if factored in properly
{
- BlueStore::Blob B;
- B.collection = coll;
+ BlueStore::Blob B(coll.get());
B.set_shared_blob(new BlueStore::SharedBlob(coll.get()));
bluestore_blob_t& b = B.dirty_blob();
PExtentVector r;
ASSERT_EQ(mas*4, b.get_extents()[0].length);
}
{
- BlueStore::Blob B;
- B.collection = coll;
+ BlueStore::Blob B(coll.get());
B.set_shared_blob(new BlueStore::SharedBlob(coll.get()));
bluestore_blob_t& b = B.dirty_blob();
b.allocated_test(bluestore_pextent_t(0x40101000, 0x4000));
cout << "r " << r << std::endl;
}
{
- BlueStore::Blob B;
- B.collection = coll;
+ BlueStore::Blob B(coll.get());
B.set_shared_blob(new BlueStore::SharedBlob(coll.get()));
bluestore_blob_t& b = B.dirty_blob();
b.allocated_test(bluestore_pextent_t(1, 0x5000));
ASSERT_EQ(0x2000u, r[0].length);
}
{
- BlueStore::Blob B;
- B.collection = coll;
+ BlueStore::Blob B(coll.get());
B.set_shared_blob(new BlueStore::SharedBlob(coll.get()));
bluestore_blob_t& b = B.dirty_blob();
b.allocated_test(bluestore_pextent_t(1, 0x7000));
g_ceph_context, "lru", NULL);
auto coll = ceph::make_ref<BlueStore::Collection>(&store, oc, bc, coll_t());
- BlueStore::Blob B;
- B.collection = coll;
+ BlueStore::Blob B(coll.get());
B.set_shared_blob(new BlueStore::SharedBlob(coll.get()));
bluestore_blob_t& b = B.dirty_blob();
b.allocated_test(bluestore_pextent_t(1, 0x5000));
g_ceph_context, "lru", NULL);
auto coll = ceph::make_ref<BlueStore::Collection>(&store, oc, bc, coll_t());
{
- BlueStore::Blob L, R;
- L.collection = coll;
- R.collection = coll;
+ BlueStore::Blob L(coll.get());
+ BlueStore::Blob R(coll.get());
L.set_shared_blob(new BlueStore::SharedBlob(coll.get()));
R.set_shared_blob(new BlueStore::SharedBlob(coll.get()));
L.dirty_blob().allocated_test(bluestore_pextent_t(0x2000, 0x2000));
ASSERT_EQ(0x1000u, R.get_referenced_bytes());
}
{
- BlueStore::Blob L, R;
- L.collection = coll;
- R.collection = coll;
+ BlueStore::Blob L(coll.get());
+ BlueStore::Blob R(coll.get());
L.set_shared_blob(new BlueStore::SharedBlob(coll.get()));
R.set_shared_blob(new BlueStore::SharedBlob(coll.get()));
L.dirty_blob().allocated_test(bluestore_pextent_t(0x2000, 0x1000));
auto coll = ceph::make_ref<BlueStore::Collection>(&store, oc, bc, coll_t());
bufferlist bl, bl2;
{
- BlueStore::Blob B;
- B.collection = coll;
+ BlueStore::Blob B(coll.get());
B.set_shared_blob(new BlueStore::SharedBlob(coll.get()));
B.dirty_blob().allocated_test(bluestore_pextent_t(0x1, 0x2000));
auto p = bl.front().begin_deep();
auto p2 = bl2.front().begin_deep();
- BlueStore::Blob Bres, Bres2;
- Bres.collection = coll;
- Bres2.collection = coll;
+ BlueStore::Blob Bres(coll.get());
+ BlueStore::Blob Bres2(coll.get());
Bres.set_shared_blob(new BlueStore::SharedBlob(coll.get()));
Bres2.set_shared_blob(new BlueStore::SharedBlob(coll.get()));
) {
uint32_t blob_length = (empty_aus + num_aus) * au_size;
BlueStore::BlobRef b(coll->new_blob());
- b->collection = coll;
bluestore_blob_t& bb = b->dirty_blob();
bb.init_csum(Checksummer::CSUM_CRC32C, csum_order, blob_length);
for(size_t i = 0; i < num_aus; ++i) {
size_t ext1_offs = 0x0;
size_t ext1_len = 0x2000;
size_t ext1_boffs = 0x0;
- BlueStore::BlobRef b1(coll->new_blob());
- b1->collection = coll;
+ BlueStore::BlobRef b1 = coll->new_blob();
auto &_b1 = b1->dirty_blob();
_b1.init_csum(Checksummer::CSUM_CRC32C, csum_order, ext1_len);
for(size_t i = 0; i < _b1.get_csum_count(); i++) {