From: Igor Fedotov Date: Wed, 25 Oct 2023 13:15:37 +0000 (+0300) Subject: os: introduce ObjectStore::refresh_perf_counters() method. X-Git-Tag: v19.3.0~312^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8f5d61df634e839b5b2c8ab223c5c5fa2c0c1dda;p=ceph.git os: introduce ObjectStore::refresh_perf_counters() method. This is a common method to refresh Object Store performance counters. Signed-off-by: Igor Fedotov --- diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index 4c837b84d010..302be387fae6 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -111,6 +111,13 @@ public: * This appears to be called with nothing locked. */ virtual objectstore_perf_stat_t get_cur_stats() = 0; + /** + * Propagate Object Store performance counters with the actual values + * + * + * Intended primarily for testing purposes + */ + virtual void refresh_perf_counters() = 0; /** * Fetch Object Store performance counters. diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index ec03fcde14ae..e8fcdce3bfe4 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -1310,6 +1310,7 @@ struct LruBufferCacheShard : public BlueStore::BufferCacheShard { uint64_t *blobs, uint64_t *buffers, uint64_t *bytes) override { + std::lock_guard l(lock); *extents += num_extents; *blobs += num_blobs; *buffers += num; @@ -1615,6 +1616,7 @@ public: uint64_t *blobs, uint64_t *buffers, uint64_t *bytes) override { + std::lock_guard l(lock); *extents += num_extents; *blobs += num_blobs; *buffers += num; @@ -5358,7 +5360,7 @@ void *BlueStore::MempoolThread::entry() _resize_shards(interval_stats_trim); interval_stats_trim = false; - store->_update_logger(); + store->refresh_perf_counters(); auto wait = ceph::make_timespan( store->cct->_conf->bluestore_cache_trim_interval); cond.wait_for(l, wait); @@ -11780,7 +11782,7 @@ void BlueStore::_reap_collections() } } -void BlueStore::_update_logger() +void BlueStore::refresh_perf_counters() { uint64_t num_onodes = 0; uint64_t num_pinned_onodes = 0; diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 095c838608ed..8079f239c71c 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -2777,7 +2777,6 @@ private: CollectionRef _get_collection_by_oid(const ghobject_t& oid); void _queue_reap_collection(CollectionRef& c); void _reap_collections(); - void _update_logger(); void _assign_nid(TransContext *txc, OnodeRef& o); uint64_t _assign_blobid(TransContext *txc); @@ -3328,6 +3327,8 @@ public: const PerfCounters* get_perf_counters() const override { return logger; } + void refresh_perf_counters() override; + const PerfCounters* get_bluefs_perf_counters() const { return bluefs->get_perf_counters(); } diff --git a/src/os/kstore/KStore.h b/src/os/kstore/KStore.h index 9e3c7acd73b4..96bbdfaa424d 100644 --- a/src/os/kstore/KStore.h +++ b/src/os/kstore/KStore.h @@ -562,6 +562,8 @@ public: objectstore_perf_stat_t get_cur_stats() override { return objectstore_perf_stat_t(); } + void refresh_perf_counters() override { + } const PerfCounters* get_perf_counters() const override { return logger; } diff --git a/src/os/memstore/MemStore.h b/src/os/memstore/MemStore.h index 858379ed9c7c..2abe552891fd 100644 --- a/src/os/memstore/MemStore.h +++ b/src/os/memstore/MemStore.h @@ -395,7 +395,8 @@ public: } objectstore_perf_stat_t get_cur_stats() override; - + void refresh_perf_counters() override { + } const PerfCounters* get_perf_counters() const override { return nullptr; } diff --git a/src/test/objectstore/ObjectStoreImitator.h b/src/test/objectstore/ObjectStoreImitator.h index c01e77897460..d71d7f2fe58b 100644 --- a/src/test/objectstore/ObjectStoreImitator.h +++ b/src/test/objectstore/ObjectStoreImitator.h @@ -354,4 +354,5 @@ public: } objectstore_perf_stat_t get_cur_stats() override { return {}; } const PerfCounters *get_perf_counters() const override { return nullptr; }; + void refresh_perf_counters() override {} };