From b1632262603403d8a9c0809ef20cb8ae47cd5130 Mon Sep 17 00:00:00 2001 From: Xuehan Xu Date: Sat, 23 May 2026 17:23:02 +0800 Subject: [PATCH] crimson/os/seastore/lba: fix wrong asserts and "if" conditions Signed-off-by: Xuehan Xu --- src/crimson/os/seastore/lba/lba_btree_node.h | 21 ++++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/crimson/os/seastore/lba/lba_btree_node.h b/src/crimson/os/seastore/lba/lba_btree_node.h index c42be7c1ba8..bd8deb37b7f 100644 --- a/src/crimson/os/seastore/lba/lba_btree_node.h +++ b/src/crimson/os/seastore/lba/lba_btree_node.h @@ -314,11 +314,14 @@ struct LBALeafNode t, it->get_key(), pending_version); ceph_abort(); } - if (is_valid_child_ptr(child) && - (child->_is_mutable() || child->_is_pending_io())) { - // skip the ones that the pending version is also modifying - it++; - continue; + if (is_valid_child_ptr(child)) { + if ((child->_is_mutable() || child->_is_pending_io())) { + // skip the ones that the pending version is also modifying + it++; + continue; + } else { + assert(child->_is_exist_clean() || child->_is_exist_mutation_pending()); + } } auto pending_key = it->get_key(); auto stable_key = iter->get_key(); @@ -328,9 +331,7 @@ struct LBALeafNode assert(pending_end <= stable_end); if (pending_key != stable_key) { assert(v2.pladdr != v1.pladdr); - assert(!is_valid_child_ptr(child) || - !child->_is_exist_clean() || - !child->_is_exist_mutation_pending()); + assert(is_valid_child_ptr(child)); } if (v2.pladdr != v1.pladdr) { auto m_v2 = v2; @@ -340,9 +341,7 @@ struct LBALeafNode m_v2.pladdr = paddr; SUBTRACET(seastore_lba, "merging to {}, paddr: {} -> {}", t, pending_version, m_v2.pladdr, paddr); - if (!is_valid_child_ptr(child) || - (!child->_is_exist_clean() && - !child->_is_exist_mutation_pending())) { + if (!is_valid_child_ptr(child)) { // exclude the mappings whose children are EXIST_CLEAN ones SUBTRACET(seastore_lba, "merging to {}, checksum: {} -> {}", t, pending_version, m_v2.checksum, v1.checksum); -- 2.47.3