]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: remove MUTABLE flag
authorSage Weil <sage@redhat.com>
Tue, 9 May 2017 02:44:29 +0000 (22:44 -0400)
committerSage Weil <sage@redhat.com>
Fri, 2 Jun 2017 18:00:58 +0000 (14:00 -0400)
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 <sage@redhat.com>
src/os/bluestore/BlueStore.cc
src/os/bluestore/bluestore_types.cc
src/os/bluestore/bluestore_types.h
src/test/objectstore/test_bluestore_types.cc

index bc7ddde833134d07cc770e009083ab6363f7e521..1983dbb1a11284be79571ab9626771717a70821b 100644 (file)
@@ -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()));
       }
index e4585aa7fbb404127b72149d9b874a769f44db09..561605792b105fae0601fda3a3bbe557af9aa660 100644 (file)
@@ -569,9 +569,6 @@ void bluestore_pextent_t::generate_test_instances(list<bluestore_pextent_t*>& 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 += '+';
index 27e76bef4f94e220aa270f4e593f5e50fa1f523c..81c051b7ca13e0ac93684ebe9bc8d25806c1b71b 100644 (file)
@@ -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);
index 8f39ecbfd873f1bfa8f8ede909f6511b51a93d26..c6f6eeec02857ab036d489ab1c83ffe6be9d05ad 100644 (file)
@@ -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());