From: Igor Fedotov Date: Fri, 2 Oct 2020 15:30:40 +0000 (+0300) Subject: os/bluestore: kill BitmapFreeListManager::_verify_range() X-Git-Tag: v16.1.0~925^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F37526%2Fhead;p=ceph.git os/bluestore: kill BitmapFreeListManager::_verify_range() Signed-off-by: Igor Fedotov --- diff --git a/src/os/bluestore/BitmapFreelistManager.cc b/src/os/bluestore/BitmapFreelistManager.cc index 4a9ad01d91ca..315a6bb8c43c 100644 --- a/src/os/bluestore/BitmapFreelistManager.cc +++ b/src/os/bluestore/BitmapFreelistManager.cc @@ -480,128 +480,6 @@ void BitmapFreelistManager::dump(KeyValueDB *kvdb) } } -void BitmapFreelistManager::_verify_range(KeyValueDB *kvdb, - uint64_t offset, uint64_t length, - int val) -{ - unsigned errors = 0; - uint64_t first_key = offset & key_mask; - uint64_t last_key = (offset + length - 1) & key_mask; - if (first_key == last_key) { - string k; - make_offset_key(first_key, &k); - bufferlist bl; - kvdb->get(bitmap_prefix, k, &bl); - if (bl.length() > 0) { - const char *p = bl.c_str(); - unsigned s = (offset & ~key_mask) / bytes_per_block; - unsigned e = ((offset + length - 1) & ~key_mask) / bytes_per_block; - for (unsigned i = s; i <= e; ++i) { - int has = !!(p[i >> 3] & (1ull << (i & 7))); - if (has != val) { - derr << __func__ << " key 0x" << std::hex << first_key << " bit 0x" - << i << " has 0x" << has << " expected 0x" << val - << std::dec << dendl; - ++errors; - } - } - } else { - if (val) { - derr << __func__ << " key 0x" << std::hex << first_key - << " not present, expected 0x" << val << std::dec << dendl; - ++errors; - } - } - } else { - // first key - { - string k; - make_offset_key(first_key, &k); - bufferlist bl; - kvdb->get(bitmap_prefix, k, &bl); - if (bl.length()) { - const char *p = bl.c_str(); - unsigned s = (offset & ~key_mask) / bytes_per_block; - unsigned e = blocks_per_key; - for (unsigned i = s; i < e; ++i) { - int has = !!(p[i >> 3] & (1ull << (i & 7))); - if (has != val) { - derr << __func__ << " key 0x" << std::hex << first_key << " bit 0x" - << i << " has 0x" << has << " expected 0x" << val << std::dec - << dendl; - ++errors; - } - } - } else { - if (val) { - derr << __func__ << " key 0x" << std::hex << first_key - << " not present, expected 0x" << val << std::dec << dendl; - ++errors; - } - } - first_key += bytes_per_key; - } - // middle keys - if (first_key < last_key) { - while (first_key < last_key) { - string k; - make_offset_key(first_key, &k); - bufferlist bl; - kvdb->get(bitmap_prefix, k, &bl); - if (bl.length() > 0) { - const char *p = bl.c_str(); - for (unsigned i = 0; i < blocks_per_key; ++i) { - int has = !!(p[i >> 3] & (1ull << (i & 7))); - if (has != val) { - derr << __func__ << " key 0x" << std::hex << first_key << " bit 0x" - << i << " has 0x" << has << " expected 0x" << val - << std::dec << dendl; - ++errors; - } - } - } else { - if (val) { - derr << __func__ << " key 0x" << std::hex << first_key - << " not present, expected 0x" << val << std::dec << dendl; - ++errors; - } - } - first_key += bytes_per_key; - } - } - ceph_assert(first_key == last_key); - { - string k; - make_offset_key(first_key, &k); - bufferlist bl; - kvdb->get(bitmap_prefix, k, &bl); - if (bl.length() > 0) { - const char *p = bl.c_str(); - unsigned e = ((offset + length - 1) & ~key_mask) / bytes_per_block; - for (unsigned i = 0; i < e; ++i) { - int has = !!(p[i >> 3] & (1ull << (i & 7))); - if (has != val) { - derr << __func__ << " key 0x" << std::hex << first_key << " bit 0x" - << i << " has 0x" << has << " expected 0x" << val << std::dec - << dendl; - ++errors; - } - } - } else { - if (val) { - derr << __func__ << " key 0x" << std::hex << first_key - << " not present, expected 0x" << val << std::dec << dendl; - ++errors; - } - } - } - } - if (errors) { - derr << __func__ << " saw " << errors << " errors" << dendl; - ceph_abort_msg("bitmap freelist errors"); - } -} - void BitmapFreelistManager::allocate( uint64_t offset, uint64_t length, KeyValueDB::Transaction txn) diff --git a/src/os/bluestore/BitmapFreelistManager.h b/src/os/bluestore/BitmapFreelistManager.h index 9689e87b37f8..c6bfe469f1b4 100644 --- a/src/os/bluestore/BitmapFreelistManager.h +++ b/src/os/bluestore/BitmapFreelistManager.h @@ -40,8 +40,6 @@ class BitmapFreelistManager : public FreelistManager { void _init_misc(); - void _verify_range(KeyValueDB *kvdb, - uint64_t offset, uint64_t length, int val); void _xor( uint64_t offset, uint64_t length, KeyValueDB::Transaction txn);