From: Adam Kupczyk Date: Thu, 14 Nov 2024 11:23:25 +0000 (+0000) Subject: os/bluestore: Add debug hooks X-Git-Tag: v20.3.0~409^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cbfc24dd7e9b3d13b76c340b60d8d56f13f75ae6;p=ceph.git os/bluestore: Add debug hooks Added debug hooks for: - init_alloc - deferred start/stop/operation This created framework for specific unit tests. These functions are as name suggests debug level, only for unittests. Signed-off-by: Adam Kupczyk --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index a024a0c2105a..c521ee8fbfc2 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -7260,7 +7260,7 @@ int BlueStore::_init_alloc() << ", free 0x" << alloc->get_free() << ", fragmentation " << alloc->get_fragmentation() << std::dec << dendl; - + if (tracepoint_debug_init_alloc_done) tracepoint_debug_init_alloc_done(); return 0; } @@ -15276,6 +15276,7 @@ int BlueStore::_deferred_replay() fake_ch = true; } OpSequencer *osr = static_cast(ch->osr.get()); + if (tracepoint_debug_deferred_replay_start) tracepoint_debug_deferred_replay_start(); KeyValueDB::Iterator it = db->get_iterator(PREFIX_DEFERRED); for (it->lower_bound(string()); it->valid(); it->next(), ++count) { dout(20) << __func__ << " replay " << pretty_binary_string(it->key()) @@ -15295,6 +15296,7 @@ int BlueStore::_deferred_replay() } bool has_some = _eliminate_outdated_deferred(deferred_txn, bluefs_extents); if (has_some) { + if (tracepoint_debug_deferred_replay_track) tracepoint_debug_deferred_replay_track(*deferred_txn); TransContext *txc = _txc_create(ch.get(), osr, nullptr); txc->deferred_txn = deferred_txn; txc->set_state(TransContext::STATE_KV_DONE); @@ -15307,6 +15309,7 @@ int BlueStore::_deferred_replay() dout(20) << __func__ << " draining osr" << dendl; _osr_register_zombie(osr); _osr_drain_all(); + if (tracepoint_debug_deferred_replay_end) tracepoint_debug_deferred_replay_end(); if (fake_ch) { new_coll_map.clear(); } diff --git a/src/os/bluestore/BlueStore.h b/src/os/bluestore/BlueStore.h index 99f8d057cf0a..12a9140ff794 100644 --- a/src/os/bluestore/BlueStore.h +++ b/src/os/bluestore/BlueStore.h @@ -3586,6 +3586,19 @@ public: void debug_set_prefer_deferred_size(uint64_t s) { prefer_deferred_size = s; } + void set_tracepoint_debug_deferred_replay_start(std::function action) { + tracepoint_debug_deferred_replay_start = action; + } + void set_tracepoint_debug_deferred_replay_end(std::function action) { + tracepoint_debug_deferred_replay_end = action; + } + void set_tracepoint_debug_deferred_replay_track( + std::function action) { + tracepoint_debug_deferred_replay_track = action; + } + void set_tracepoint_debug_init_alloc_done(std::function action) { + tracepoint_debug_init_alloc_done = action; + } inline void log_latency(const char* name, int idx, const ceph::timespan& lat, @@ -3601,6 +3614,11 @@ public: int idx2 = l_bluestore_first); private: + std::function tracepoint_debug_deferred_replay_start = nullptr; + std::function tracepoint_debug_deferred_replay_end = nullptr; + std::function + tracepoint_debug_deferred_replay_track = nullptr; + std::function tracepoint_debug_init_alloc_done = nullptr; bool _debug_data_eio(const ghobject_t& o) { if (!cct->_conf->bluestore_debug_inject_read_err) { return false;