From 18cc7668008e5b40a9cca3325f1b8b14341f1188 Mon Sep 17 00:00:00 2001 From: Igor Fedotov Date: Tue, 4 Oct 2022 16:11:26 +0300 Subject: [PATCH] os/bluestore: invalidate statfs completely when destaging allocations Signed-off-by: Igor Fedotov --- src/os/bluestore/BlueStore.cc | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 39ffa942f338..a49ba12220df 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -6786,6 +6786,18 @@ void BlueStore::_close_db() auto t = db->get_transaction(); store_statfs_t s; if (per_pool_stat_collection) { + KeyValueDB::Iterator it = db->get_iterator(PREFIX_STAT, KeyValueDB::ITERATOR_NOCACHE); + uint64_t pool_id; + for (it->upper_bound(string()); it->valid(); it->next()) { + int r = get_key_pool_stat(it->key(), &pool_id); + if (r >= 0) { + dout(10) << __func__ << " wiping statfs for: " << pool_id << dendl; + } else { + derr << __func__ << " wiping invalid statfs key: " << it->key() << dendl; + } + t->rmkey(PREFIX_STAT, it->key()); + } + std::lock_guard l(vstatfs_lock); for(auto &p : osd_pools) { string key; @@ -6795,14 +6807,9 @@ void BlueStore::_close_db() p.second.encode(bl); p.second.publish(&s); t->set(PREFIX_STAT, key, bl); - dout(10) << __func__ << "persisting: " + dout(10) << __func__ << " persisting: " << p.first << "->" << s << dendl; - } else { - t->rmkey(PREFIX_STAT, key); - dout(10) << __func__ << "persisting: " - << p.first << "-> " - << dendl; } } } else { @@ -6970,7 +6977,7 @@ void BlueStore::_open_statfs() st.decode(p); vstatfs += st; - dout(30) << __func__ << " pool " << std::hex << pool_id + dout(10) << __func__ << " pool " << std::hex << pool_id << " statfs(hex) " << st << std::dec << dendl; } catch (ceph::buffer::error& e) { @@ -6979,7 +6986,7 @@ void BlueStore::_open_statfs() } } } - dout(30) << __func__ << " statfs " << std::hex + dout(10) << __func__ << " statfs " << std::hex << vstatfs << std::dec << dendl; } -- 2.47.3