]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
os/bluestore: improve cache_onode and cache_buffer mempool accounting
authorDeepika Upadhyay <deepika@koor.tech>
Mon, 12 Sep 2022 09:54:37 +0000 (15:24 +0530)
committerDeepika Upadhyay <deepika@koor.tech>
Tue, 1 Nov 2022 07:02:50 +0000 (12:32 +0530)
* move physical extent to mempool bluestore_extent from cache_other
* move bluestore_shared_blob_t from cache_other to shared_blob mempool

Signed-off-by: Deepika Upadhyay <deepika@koor.tech>
src/include/mempool.h
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h
src/os/bluestore/bluestore_types.cc
src/os/bluestore/bluestore_types.h
src/test/objectstore/store_test.cc

index 08d8282fb2f0e53c8d5e033df71aecf6ae8a3ed1..076c62afe191ab38ff2a4c8f38bb83e992ca5e5c 100644 (file)
@@ -153,10 +153,10 @@ namespace mempool {
   f(bluestore_cache_onode)           \
   f(bluestore_cache_meta)            \
   f(bluestore_cache_other)           \
-  f(bluestore_Buffer)                \
-  f(bluestore_Extent)                \
-  f(bluestore_Blob)                  \
-  f(bluestore_SharedBlob)            \
+  f(bluestore_cache_buffer)          \
+  f(bluestore_extent)                \
+  f(bluestore_blob)                  \
+  f(bluestore_shared_blob)           \
   f(bluestore_inline_bl)             \
   f(bluestore_fsck)                  \
   f(bluestore_txc)                   \
index 95eb915ab793413b72e1bef4b9cbe866f66aaaa9..509aaefb3dae3dc9e8b471a30726de74c74983fa 100644 (file)
@@ -74,15 +74,14 @@ using bid_t = decltype(BlueStore::Blob::id);
 MEMPOOL_DEFINE_OBJECT_FACTORY(BlueStore::Onode, bluestore_onode,
                              bluestore_cache_onode);
 
-// bluestore_cache_other
 MEMPOOL_DEFINE_OBJECT_FACTORY(BlueStore::Buffer, bluestore_buffer,
-                             bluestore_Buffer);
+                             bluestore_cache_buffer);
 MEMPOOL_DEFINE_OBJECT_FACTORY(BlueStore::Extent, bluestore_extent,
-                             bluestore_Extent);
+                             bluestore_extent);
 MEMPOOL_DEFINE_OBJECT_FACTORY(BlueStore::Blob, bluestore_blob,
-                             bluestore_Blob);
+                             bluestore_blob);
 MEMPOOL_DEFINE_OBJECT_FACTORY(BlueStore::SharedBlob, bluestore_shared_blob,
-                             bluestore_SharedBlob);
+                             bluestore_shared_blob);
 
 // bluestore_txc
 MEMPOOL_DEFINE_OBJECT_FACTORY(BlueStore::TransContext, bluestore_transcontext,
index 315e6c516dfea7a4538af8dd21bf520dbcae9820..77b6b188b8e7aa1d6eee443165441b7663566ffa 100644 (file)
@@ -2164,8 +2164,8 @@ private:
   bool collections_had_errors = false;
   std::map<coll_t,CollectionRef> new_coll_map;
 
-  std::vector<OnodeCacheShard*> onode_cache_shards;
-  std::vector<BufferCacheShard*> buffer_cache_shards;
+  mempool::bluestore_cache_buffer::vector<BufferCacheShard*> buffer_cache_shards;
+  mempool::bluestore_cache_onode::vector<OnodeCacheShard*> onode_cache_shards;
 
   /// protect zombie_osr_set
   ceph::mutex zombie_osr_lock = ceph::make_mutex("BlueStore::zombie_osr_lock");
@@ -2440,13 +2440,13 @@ private:
         }
       }
       virtual uint64_t _get_used_bytes() const {
-        return mempool::bluestore_Buffer::allocated_bytes() +
-          mempool::bluestore_Blob::allocated_bytes() +
-          mempool::bluestore_Extent::allocated_bytes() +
+        return mempool::bluestore_blob::allocated_bytes() +
+          mempool::bluestore_extent::allocated_bytes() +
+          mempool::bluestore_cache_buffer::allocated_bytes() +
           mempool::bluestore_cache_meta::allocated_bytes() +
           mempool::bluestore_cache_other::allocated_bytes() +
           mempool::bluestore_cache_onode::allocated_bytes() +
-          mempool::bluestore_SharedBlob::allocated_bytes() +
+          mempool::bluestore_shared_blob::allocated_bytes() +
           mempool::bluestore_inline_bl::allocated_bytes();
       }
       virtual void shift_bins() {
index b62f6e2a3670b00ff7da37048685e0e9b364468f..904b6fbd3d9872660f47194b7fce1459b2d42309 100644 (file)
@@ -1058,7 +1058,7 @@ void bluestore_blob_t::split(uint32_t blob_offset, bluestore_blob_t& rb)
 
 // bluestore_shared_blob_t
 MEMPOOL_DEFINE_OBJECT_FACTORY(bluestore_shared_blob_t, bluestore_shared_blob_t,
-                 bluestore_cache_other);
+                 bluestore_shared_blob);
 
 void bluestore_shared_blob_t::dump(Formatter *f) const
 {
index 9c4fc5bfdc3d441776a9eac177ecad70b6239408..4c96e8903260f005436029913cdd86228f928318 100644 (file)
@@ -27,7 +27,6 @@
 #include "common/hobject.h"
 #include "compressor/Compressor.h"
 #include "common/Checksummer.h"
-#include "include/mempool.h"
 #include "include/ceph_hash.h"
 
 namespace ceph {
index dd95a0bc10875b68b86e78cf06441f413d428fdc..e437bd67cc62bc841715d0be6d340e58f08f0b21 100644 (file)
@@ -7002,10 +7002,14 @@ TEST_P(StoreTestSpecificAUSize, OnodeSizeTracking) {
   coll_t cid;
   ghobject_t hoid(hobject_t("test_hint", "", CEPH_NOSNAP, 0, -1, ""));
   size_t obj_size = 4 * 1024  * 1024;
+  uint64_t total_bytes_prev;
   uint64_t total_bytes, total_bytes2;
   uint64_t total_onodes;
   get_mempool_stats(&total_bytes, &total_onodes);
-  ASSERT_EQ(total_onodes, 0u);
+  total_bytes_prev = total_bytes;
+  // 5u for onode_cache_shards vector
+  ASSERT_EQ(total_onodes, 5u);
+  ASSERT_EQ(total_bytes, 40u);
 
   auto ch = store->create_new_collection(cid);
   {
@@ -7024,8 +7028,8 @@ TEST_P(StoreTestSpecificAUSize, OnodeSizeTracking) {
     ASSERT_EQ(r, 0);
   }
   get_mempool_stats(&total_bytes, &total_onodes);
-  ASSERT_NE(total_bytes, 0u);
-  ASSERT_EQ(total_onodes, 1u);
+  ASSERT_GT(total_bytes - total_bytes_prev, 0u);
+  ASSERT_EQ(total_onodes, 6u);
 
   {
     ObjectStore::Transaction t;
@@ -7045,7 +7049,7 @@ TEST_P(StoreTestSpecificAUSize, OnodeSizeTracking) {
     }
     get_mempool_stats(&total_bytes2, &total_onodes);
     ASSERT_NE(total_bytes2, 0u);
-    ASSERT_EQ(total_onodes, 1u);
+    ASSERT_EQ(total_onodes, 6u);
   }
   {
     cout <<" mempool dump:\n";
@@ -7064,7 +7068,7 @@ TEST_P(StoreTestSpecificAUSize, OnodeSizeTracking) {
   }
   get_mempool_stats(&total_bytes, &total_onodes);
   ASSERT_NE(total_bytes, 0u);
-  ASSERT_EQ(total_onodes, 1u);
+  ASSERT_EQ(total_onodes, 6u);
 
   {
     cout <<" mempool dump:\n";