From 4c2e698da282d1812ffbac7de95aa97cd96a1a53 Mon Sep 17 00:00:00 2001 From: Radoslaw Zarzynski Date: Mon, 21 Apr 2025 07:39:23 +0000 Subject: [PATCH] crimson: fix unused variable warnings due to assert() and NDEBUG builds Signed-off-by: Radoslaw Zarzynski (cherry picked from commit 1cb23c32e65315235522365f281aa3f6811e160a) --- src/crimson/os/seastore/btree/fixed_kv_btree.h | 2 +- src/crimson/os/seastore/journal/circular_journal_space.h | 2 +- src/crimson/os/seastore/lba_manager/btree/btree_lba_manager.h | 2 +- src/crimson/os/seastore/linked_tree_node.h | 3 ++- .../os/seastore/omap_manager/btree/omap_btree_node_impl.cc | 2 +- src/crimson/osd/pg_map.cc | 4 ++-- src/crimson/osd/pg_recovery.cc | 2 +- 7 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/crimson/os/seastore/btree/fixed_kv_btree.h b/src/crimson/os/seastore/btree/fixed_kv_btree.h index a635407dcadb8..bb7ae563b0c1b 100644 --- a/src/crimson/os/seastore/btree/fixed_kv_btree.h +++ b/src/crimson/os/seastore/btree/fixed_kv_btree.h @@ -1568,7 +1568,7 @@ private: *parent_entry.node, parent_entry.pos, *child); - auto &cnode = (typename internal_node_t::base_t &)*child; + [[maybe_unused]] auto &cnode = (typename internal_node_t::base_t &)*child; assert(cnode.get_node_meta().begin == node_iter.get_key()); assert(cnode.get_node_meta().end > node_iter.get_key()); return on_found(child->template cast()); diff --git a/src/crimson/os/seastore/journal/circular_journal_space.h b/src/crimson/os/seastore/journal/circular_journal_space.h index 920b5d78d30a8..ade33d8f297cd 100644 --- a/src/crimson/os/seastore/journal/circular_journal_space.h +++ b/src/crimson/os/seastore/journal/circular_journal_space.h @@ -148,7 +148,7 @@ class CircularJournalSpace : public JournalAllocator { return convert_paddr_to_abs_addr(seq.offset); } void set_written_to(journal_seq_t seq) { - rbm_abs_addr addr = convert_paddr_to_abs_addr(seq.offset); + [[maybe_unused]] rbm_abs_addr addr = convert_paddr_to_abs_addr(seq.offset); assert(addr >= get_records_start()); assert(addr < get_journal_end()); written_to = seq; diff --git a/src/crimson/os/seastore/lba_manager/btree/btree_lba_manager.h b/src/crimson/os/seastore/lba_manager/btree/btree_lba_manager.h index b0ba9e167dcbf..97ab4aeca353f 100644 --- a/src/crimson/os/seastore/lba_manager/btree/btree_lba_manager.h +++ b/src/crimson/os/seastore/lba_manager/btree/btree_lba_manager.h @@ -688,7 +688,7 @@ private: auto ait = alloc_infos.begin(); for (; mit != mappings.end(); mit++, ait++) { auto mapping = static_cast(mit->release()); - auto &alloc_info = *ait; + [[maybe_unused]] auto &alloc_info = *ait; assert(mapping->get_key() == alloc_info.key); assert(mapping->get_raw_val().get_laddr() == alloc_info.val.get_laddr()); diff --git a/src/crimson/os/seastore/linked_tree_node.h b/src/crimson/os/seastore/linked_tree_node.h index 013f401cc4a5f..9ab7b750b18c2 100644 --- a/src/crimson/os/seastore/linked_tree_node.h +++ b/src/crimson/os/seastore/linked_tree_node.h @@ -417,7 +417,8 @@ protected: iter, t.add_transactional_view(t)); } auto ©_dests = static_cast(*iter); - auto [it, inserted] = copy_dests.dests_by_key.insert(dest); + [[maybe_unused]] auto [it, inserted] = + copy_dests.dests_by_key.insert(dest); assert(inserted || it->get() == dest.get()); } diff --git a/src/crimson/os/seastore/omap_manager/btree/omap_btree_node_impl.cc b/src/crimson/os/seastore/omap_manager/btree/omap_btree_node_impl.cc index 746a6cdcdf572..266bde312fd03 100644 --- a/src/crimson/os/seastore/omap_manager/btree/omap_btree_node_impl.cc +++ b/src/crimson/os/seastore/omap_manager/btree/omap_btree_node_impl.cc @@ -293,7 +293,7 @@ OMapInnerNode::list( } } if (child_result.size() && last && iter == liter - 1) { - auto biter = --(child_result.end()); + [[maybe_unused]] auto biter = --(child_result.end()); if (config.last_inclusive) { assert(biter->first <= *last); } else { diff --git a/src/crimson/osd/pg_map.cc b/src/crimson/osd/pg_map.cc index 2f5c0660cc38a..ee65646205ece 100644 --- a/src/crimson/osd/pg_map.cc +++ b/src/crimson/osd/pg_map.cc @@ -73,7 +73,7 @@ seastar::future PGShardMapping::get_or_create_pg_mapping( } ceph_assert_always(primary_mapping.core_to_num_pgs.end() != count_iter); ++(count_iter->second); - auto [insert_iter, inserted] = + [[maybe_unused]] auto [insert_iter, inserted] = primary_mapping.pg_to_core.emplace(pgid, core_to_update); assert(inserted); DEBUG("mapping pg {} to core {} (primary): num_pgs {}", @@ -86,7 +86,7 @@ seastar::future PGShardMapping::get_or_create_pg_mapping( if (find_iter == other_mapping.pg_to_core.end()) { DEBUG("mapping pg {} to core {} (others)", pgid, core_to_update); - auto [insert_iter, inserted] = + [[maybe_unused]] auto [insert_iter, inserted] = other_mapping.pg_to_core.emplace(pgid, core_to_update); assert(inserted); } else { diff --git a/src/crimson/osd/pg_recovery.cc b/src/crimson/osd/pg_recovery.cc index 09b9875a85b9c..84a8b2c235b41 100644 --- a/src/crimson/osd/pg_recovery.cc +++ b/src/crimson/osd/pg_recovery.cc @@ -409,7 +409,7 @@ PGRecovery::on_local_recover( [soid, &recovery_info, is_delete, &t, this] { if (soid.is_snap()) { OSDriver::OSTransaction _t(pg->get_osdriver().get_transaction(&t)); - int r = pg->get_snap_mapper().remove_oid(soid, &_t); + [[maybe_unused]] int r = pg->get_snap_mapper().remove_oid(soid, &_t); assert(r == 0 || r == -ENOENT); if (!is_delete) { -- 2.39.5