// update blob
blob.set_flag(bluestore_blob_t::FLAG_SHARED);
- blob.clear_flag(bluestore_blob_t::FLAG_MUTABLE);
// update shared blob
b->shared_blob->loaded = true;
}
if (!compressed && wi.new_blob) {
// initialize newly created blob only
- assert(!dblob.has_flag(bluestore_blob_t::FLAG_MUTABLE));
- dblob.set_flag(bluestore_blob_t::FLAG_MUTABLE);
-
+ assert(dblob.is_mutable());
if (l->length() != wi.blob_length) {
// hrm, maybe we could do better here, but let's not bother.
dout(20) << __func__ << " forcing csum_order to block_size_order "
<< block_size_order << dendl;
- csum_order = block_size_order;
+ csum_order = block_size_order;
} else {
csum_order = std::min(wctx->csum_order, ctz(l->length()));
}
string bluestore_blob_t::get_flags_string(unsigned flags)
{
string s;
- if (flags & FLAG_MUTABLE) {
- s = "mutable";
- }
if (flags & FLAG_COMPRESSED) {
if (s.length())
s += '+';
public:
enum {
- FLAG_MUTABLE = 1, ///< blob can be overwritten or split
+ LEGACY_FLAG_MUTABLE = 1, ///< [legacy] blob can be overwritten or split
FLAG_COMPRESSED = 2, ///< blob is compressed
FLAG_CSUM = 4, ///< blob has checksums
FLAG_HAS_UNUSED = 8, ///< blob has unused map
compressed_length = clen;
}
bool is_mutable() const {
- return has_flag(FLAG_MUTABLE);
+ return !is_compressed() && !is_shared();
}
bool is_compressed() const {
return has_flag(FLAG_COMPRESSED);
TEST(bluestore_blob_t, can_split)
{
bluestore_blob_t a;
- a.flags = bluestore_blob_t::FLAG_MUTABLE;
ASSERT_TRUE(a.can_split());
a.flags = bluestore_blob_t::FLAG_SHARED;
ASSERT_FALSE(a.can_split());
TEST(bluestore_blob_t, can_split_at)
{
bluestore_blob_t a;
- a.flags = bluestore_blob_t::FLAG_MUTABLE;
a.allocated_test(bluestore_pextent_t(0x10000, 0x2000));
a.allocated_test(bluestore_pextent_t(0x20000, 0x2000));
ASSERT_TRUE(a.can_split_at(0x1000));
TEST(bluestore_blob_t, prune_tail)
{
bluestore_blob_t a;
- a.flags = bluestore_blob_t::FLAG_MUTABLE;
a.allocated_test(bluestore_pextent_t(0x10000, 0x2000));
a.allocated_test(bluestore_pextent_t(0x20000, 0x2000));
ASSERT_FALSE(a.can_prune_tail());