ceph_assert(p.second);
iter = std::move(p.first);
auto &leaf_node = *iter.get_leaf_node();
+ bool need_reserved_ptr =
+ info.is_indirect_mapping() || info.is_zero_mapping();
leaf_node.insert_child_ptr(
iter.get_leaf_pos(),
- info.extent,
+ need_reserved_ptr
+ ? get_reserved_ptr<LBALeafNode, laddr_t>()
+ : static_cast<BaseChildNode<LBALeafNode, laddr_t>*>(info.extent),
leaf_node.get_size() - 1 /*the size before the insert*/);
if (is_valid_child_ptr(info.extent)) {
ceph_assert(info.value.pladdr.is_paddr());
lba_map_val_t value;
LogicalChildNode* extent = nullptr;
+ bool is_zero_mapping() const {
+ return value.pladdr.is_paddr() && value.pladdr.get_paddr().is_zero();
+ }
+
+ bool is_indirect_mapping() const {
+ return value.pladdr.is_laddr();
+ }
+
static alloc_mapping_info_t create_zero(extent_len_t len) {
return {
L_ADDR_NULL,
pladdr_t(P_ADDR_ZERO),
EXTENT_DEFAULT_REF_COUNT,
0
- },
- static_cast<LogicalChildNode*>(get_reserved_ptr<LBALeafNode, laddr_t>())};
+ }};
}
static alloc_mapping_info_t create_indirect(
laddr_t laddr,
EXTENT_DEFAULT_REF_COUNT,
0 // crc will only be used and checked with LBA direct mappings
// also see pin_to_extent(_by_type)
- },
- static_cast<LogicalChildNode*>(get_reserved_ptr<LBALeafNode, laddr_t>())};
+ }};
}
static alloc_mapping_info_t create_direct(
laddr_t laddr,