From: Sage Weil Date: Tue, 4 Apr 2017 15:52:24 +0000 (-0400) Subject: os/bluestore: do not extend blobs with unused bitmap X-Git-Tag: v12.0.2~183^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f8f909496435dcb889cd7fe7339b1e393abfbbb0;p=ceph.git os/bluestore: do not extend blobs with unused bitmap 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 --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index a58b589f4d68..50642358ce04 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -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; diff --git a/src/os/bluestore/bluestore_types.h b/src/os/bluestore/bluestore_types.h index 9d9b1e34eb8c..e5b62568318e 100644 --- a/src/os/bluestore/bluestore_types.h +++ b/src/os/bluestore/bluestore_types.h @@ -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 {