]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: do not extend blobs with unused bitmap
authorSage Weil <sage@redhat.com>
Tue, 4 Apr 2017 15:52:24 +0000 (11:52 -0400)
committerSage Weil <sage@redhat.com>
Tue, 4 Apr 2017 16:12:26 +0000 (12:12 -0400)
If we resize the blob we need to adjust the resolution of the
unused bitmap, and that is only possible for some bit patterns.
For now just ignore blobs with unused blocks.

Add an assert in add_tail() so that we don't forget that
add_tail is (probably) where we'd would do that adjustment.

Signed-off-by: Sage Weil <sage@redhat.com>
src/os/bluestore/BlueStore.cc
src/os/bluestore/bluestore_types.h

index a58b589f4d68b00c4783b5b77683dd88a541acbe..50642358ce0401ab6d0cf2928c594beb78e2e6e1 100644 (file)
@@ -1784,6 +1784,11 @@ bool BlueStore::Blob::try_reuse_blob(uint32_t min_alloc_size,
       return false;
     }
 
+    // FIXME: in some cases we could reduce unused resolution
+    if (get_blob().has_unused()) {
+      return false;
+    }
+
     if (overflow > 0) {
       new_blen -= overflow;
       length -= overflow;
index 9d9b1e34eb8c13a5640371d69bba275314628d26..e5b62568318e63c148d94edcbfa1bbdf18f4daa4 100644 (file)
@@ -863,6 +863,7 @@ public:
   }
   void add_tail(uint32_t new_len) {
     assert(is_mutable());
+    assert(!has_unused());
     assert(new_len > logical_length);
     extents.emplace_back(
       bluestore_pextent_t(
@@ -872,9 +873,10 @@ public:
     if (has_csum()) {
       bufferptr t;
       t.swap(csum_data);
-      csum_data = buffer::create(get_csum_value_size() * logical_length / get_csum_chunk_size());
+      csum_data = buffer::create(
+       get_csum_value_size() * logical_length / get_csum_chunk_size());
       csum_data.copy_in(0, t.length(), t.c_str());
-      csum_data.zero( t.length(), csum_data.length() - t.length());
+      csum_data.zero(t.length(), csum_data.length() - t.length());
     }
   }
   uint32_t get_release_size(uint32_t min_alloc_size) const {