]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
include/mempool: rename containers -> types
authorSage Weil <sage@redhat.com>
Tue, 11 Oct 2016 20:47:16 +0000 (16:47 -0400)
committerSage Weil <sage@redhat.com>
Wed, 2 Nov 2016 17:48:48 +0000 (13:48 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
src/global/mempool.cc
src/include/mempool.h

index ec96d7cca415a92d7b8e23e3bcec15a5fe040f5d..f5513d1fbab642b3c845177a0d25912484f232a8 100644 (file)
@@ -93,8 +93,8 @@ void mempool::pool_t::get_stats(
     total->bytes += shard[i].bytes;
     if (debug) {
       std::unique_lock<std::mutex> shard_lock(shard[i].lock);
-      for (const list_member_t *p = shard[i].containers.next;
-          p != &shard[i].containers;
+      for (const list_member_t *p = shard[i].types.next;
+          p != &shard[i].types;
           p = p->next) {
        const pool_allocator_base_t *c =
          reinterpret_cast<const pool_allocator_base_t *>(p);
index 74fdc15193036847eab79571c2cb24328a603d39..8b4c07c70636db0c4e066b59982daaaf98d90b25 100644 (file)
@@ -218,8 +218,8 @@ enum { num_shards = 64 };
 struct shard_t {
   std::atomic<size_t> bytes = {0};
   std::atomic<size_t> items = {0};
-  mutable std::mutex lock;  // only used for containers list
-  list_member_t containers; // protected by lock
+  mutable std::mutex lock;  // only used for types list
+  list_member_t types;      // protected by lock
 };
 
 struct stats_t {
@@ -234,7 +234,7 @@ struct stats_t {
 // Root of all allocators, this enables the container information to
 // operation easily. These fields are "always" accurate.
 struct pool_allocator_base_t {
-  list_member_t list_member;
+  list_member_t list_member;   // this must come first; see get_stats() hackery
 
   pool_t *pool = nullptr;
   shard_t *shard = nullptr;
@@ -302,7 +302,7 @@ inline void pool_allocator_base_t::attach_pool(
 
   // unconditionally register type, even if debug is currently off
   std::unique_lock<std::mutex> lock(shard->lock);
-  shard->containers.insert(&list_member);
+  shard->types.insert(&list_member);
 }
 
 inline pool_allocator_base_t::~pool_allocator_base_t()