From e0bf7dede5a64e3bbcde2fe496992c5eea21284e Mon Sep 17 00:00:00 2001 From: Adam Kupczyk Date: Tue, 1 Jul 2025 11:54:01 +0000 Subject: [PATCH] os/bluestore: Tiny refactor Moved statfs initialization that is done after onode recovery from read_allocation_from_onodes() to reconstruct_allocations(). Signed-off-by: Adam Kupczyk --- src/os/bluestore/BlueStore.cc | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index d74b11bbdaa8..12cb8573f188 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -20875,6 +20875,23 @@ int BlueStore::read_allocation_from_onodes(SimpleBitmap *sbmap, read_alloc_stats ++stats.shard_count; } } + return 0; +} + +//--------------------------------------------------------- +int BlueStore::reconstruct_allocations(SimpleBitmap *sbmap, read_alloc_stats_t &stats) +{ + // first set space used by superblock + auto super_length = std::max(min_alloc_size, SUPER_RESERVED); + set_allocation_in_simple_bmap(sbmap, 0, super_length); + stats.extent_count++; + + // then set all space taken by Objects + int ret = read_allocation_from_onodes(sbmap, stats); + if (ret < 0) { + derr << "failed read_allocation_from_onodes()" << dendl; + return ret; + } std::lock_guard l(vstatfs_lock); store_statfs_t s; @@ -20896,23 +20913,6 @@ int BlueStore::read_allocation_from_onodes(SimpleBitmap *sbmap, read_alloc_stats vstatfs.publish(&s); dout(5) << __func__ << " recovered " << s << dendl; - return 0; -} - -//--------------------------------------------------------- -int BlueStore::reconstruct_allocations(SimpleBitmap *sbmap, read_alloc_stats_t &stats) -{ - // first set space used by superblock - auto super_length = std::max(min_alloc_size, SUPER_RESERVED); - set_allocation_in_simple_bmap(sbmap, 0, super_length); - stats.extent_count++; - - // then set all space taken by Objects - int ret = read_allocation_from_onodes(sbmap, stats); - if (ret < 0) { - derr << "failed read_allocation_from_onodes()" << dendl; - return ret; - } return 0; } -- 2.47.3