Skip to content

Commit ca2879d

Browse files
committed
crimson/os/seastore/btree: only compile debug-purposed methods in debug
builds Signed-off-by: Xuehan Xu <[email protected]>
1 parent 52608ba commit ca2879d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/crimson/os/seastore/btree/fixed_kv_btree.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ class FixedKVBtree {
101101
op_context_t c,
102102
mapped_space_visitor_t *visitor=nullptr) const
103103
{
104+
#ifndef NDEBUG
104105
assert_valid();
106+
#endif
105107
assert(!is_end());
106108

107109
auto ret = *this;
@@ -126,7 +128,9 @@ class FixedKVBtree {
126128

127129
iterator_fut prev(op_context_t c) const
128130
{
131+
#ifndef NDEBUG
129132
assert_valid();
133+
#endif
130134
assert(!is_begin());
131135

132136
auto ret = *this;
@@ -167,6 +171,7 @@ class FixedKVBtree {
167171
});
168172
}
169173

174+
#ifndef NDEBUG
170175
void assert_valid() const {
171176
assert(leaf.node);
172177
assert(leaf.pos <= leaf.node->get_size());
@@ -183,6 +188,7 @@ class FixedKVBtree {
183188
}
184189
}
185190
}
191+
#endif
186192

187193
depth_t get_depth() const {
188194
return internal.size() + 1;
@@ -555,9 +561,11 @@ class FixedKVBtree {
555561
"ret.leaf.pos {}",
556562
c.trans,
557563
ret.leaf.pos);
564+
#ifndef NDEBUG
558565
if (min_depth == 1) {
559566
ret.assert_valid();
560567
}
568+
#endif
561569
return std::move(ret);
562570
});
563571
}

0 commit comments

Comments
 (0)