From: Sage Weil Date: Mon, 29 May 2017 01:19:44 +0000 (-0400) Subject: mempool: allow pool counts to be adjusted explicitly X-Git-Tag: v12.1.0~334^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1dc6393daf3e04b56fa7c4e21e3b79a0bc8219c9;p=ceph-ci.git mempool: allow pool counts to be adjusted explicitly Signed-off-by: Sage Weil --- diff --git a/src/common/mempool.cc b/src/common/mempool.cc index 15643567b9b..ccb74dd1ea0 100644 --- a/src/common/mempool.cc +++ b/src/common/mempool.cc @@ -77,6 +77,13 @@ size_t mempool::pool_t::allocated_items() const return (size_t) result; } +void mempool::pool_t::adjust_count(ssize_t items, ssize_t bytes) +{ + shard_t *shard = pick_a_shard(); + shard->items += items; + shard->bytes += bytes; +} + void mempool::pool_t::get_stats( stats_t *total, std::map *by_type) const diff --git a/src/include/mempool.h b/src/include/mempool.h index 016b76b9c66..4914313a300 100644 --- a/src/include/mempool.h +++ b/src/include/mempool.h @@ -218,6 +218,8 @@ public: size_t allocated_bytes() const; size_t allocated_items() const; + void adjust_count(ssize_t items, ssize_t bytes); + shard_t* pick_a_shard() { // Dirt cheap, see: // http://fossies.org/dox/glibc-2.24/pthread__self_8c_source.html