From ac4981160e790368cbb49b469937bee83edd26fb Mon Sep 17 00:00:00 2001 From: Xuehan Xu Date: Thu, 16 May 2024 14:56:20 +0800 Subject: [PATCH] crimson/os/seastore: add comments to highlight necessary invariants Signed-off-by: Xuehan Xu --- src/crimson/os/seastore/btree/fixed_kv_btree.h | 6 ++++++ src/crimson/os/seastore/transaction_manager.h | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/src/crimson/os/seastore/btree/fixed_kv_btree.h b/src/crimson/os/seastore/btree/fixed_kv_btree.h index b0901213716..9a8dd52c361 100644 --- a/src/crimson/os/seastore/btree/fixed_kv_btree.h +++ b/src/crimson/os/seastore/btree/fixed_kv_btree.h @@ -1515,6 +1515,8 @@ private: }; auto v = parent->template get_child(c, node_iter); + // checking the lba child must be atomic with creating + // and linking the absent child if (v.has_child()) { return v.get_child_fut().safe_then( [on_found=std::move(on_found), node_iter, c, @@ -1583,6 +1585,8 @@ private: }; auto v = parent->template get_child(c, node_iter); + // checking the lba child must be atomic with creating + // and linking the absent child if (v.has_child()) { return v.get_child_fut().safe_then( [on_found=std::move(on_found), node_iter, c, @@ -2136,6 +2140,8 @@ private: }; auto v = parent_pos.node->template get_child(c, donor_iter); + // checking the lba child must be atomic with creating + // and linking the absent child if (v.has_child()) { return v.get_child_fut().safe_then( [do_merge=std::move(do_merge), &pos, diff --git a/src/crimson/os/seastore/transaction_manager.h b/src/crimson/os/seastore/transaction_manager.h index a6ee603866b..66574cc4225 100644 --- a/src/crimson/os/seastore/transaction_manager.h +++ b/src/crimson/os/seastore/transaction_manager.h @@ -176,6 +176,8 @@ public: Transaction &t, LBAMappingRef pin) { + // checking the lba child must be atomic with creating + // and linking the absent child auto ret = get_extent_if_linked(t, std::move(pin)); if (ret.index() == 1) { return std::move(std::get<1>(ret)); @@ -214,6 +216,8 @@ public: extent_types_t type) { auto v = pin->get_logical_extent(t); + // checking the lba child must be atomic with creating + // and linking the absent child if (v.has_child()) { return std::move(v.get_child_fut()); } else { -- 2.39.5