From: Sage Weil Date: Tue, 9 May 2017 02:44:29 +0000 (-0400) Subject: os/bluestore: remove MUTABLE flag X-Git-Tag: ses5-milestone6~8^2~8^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=eebfd47e2ed4fcbc6b9de4542c351b942fb3d05c;p=ceph.git os/bluestore: remove MUTABLE flag This flag is confusingly redundant as it is equivalent to !compressed && !shared. Remove the flag and reimplement is_mutable() in terms of the other two flags. Signed-off-by: Sage Weil --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index bc7ddde83313..1983dbb1a112 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -3081,7 +3081,6 @@ void BlueStore::Collection::make_blob_shared(uint64_t sbid, BlobRef b) // 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; @@ -9637,14 +9636,12 @@ int BlueStore::_do_alloc_write( } 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())); } diff --git a/src/os/bluestore/bluestore_types.cc b/src/os/bluestore/bluestore_types.cc index e4585aa7fbb4..561605792b10 100644 --- a/src/os/bluestore/bluestore_types.cc +++ b/src/os/bluestore/bluestore_types.cc @@ -569,9 +569,6 @@ void bluestore_pextent_t::generate_test_instances(list& ls 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 += '+'; diff --git a/src/os/bluestore/bluestore_types.h b/src/os/bluestore/bluestore_types.h index 27e76bef4f94..81c051b7ca13 100644 --- a/src/os/bluestore/bluestore_types.h +++ b/src/os/bluestore/bluestore_types.h @@ -484,7 +484,7 @@ private: 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 @@ -596,7 +596,7 @@ public: 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); diff --git a/src/test/objectstore/test_bluestore_types.cc b/src/test/objectstore/test_bluestore_types.cc index 8f39ecbfd873..c6f6eeec0285 100644 --- a/src/test/objectstore/test_bluestore_types.cc +++ b/src/test/objectstore/test_bluestore_types.cc @@ -828,7 +828,6 @@ TEST(Blob, put_ref) 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()); @@ -841,7 +840,6 @@ TEST(bluestore_blob_t, 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)); @@ -856,7 +854,6 @@ TEST(bluestore_blob_t, can_split_at) 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());