return out << "lba_map_val_t("
<< v.pladdr
<< "~0x" << std::hex << v.len
+ << ", type=" << (extent_types_t)v.type
<< ", checksum=0x" << v.checksum
<< ", refcount=" << std::dec << v.refcount
<< ")";
// laddr of a direct lba mapping(see btree_lba_manager.h)
extent_ref_count_t refcount = 0; ///< refcount
checksum_t checksum = 0; ///< checksum of original block written at paddr (TODO)
+ extent_types_t type = extent_types_t::NONE;
lba_map_val_t() = default;
lba_map_val_t(
extent_len_t len,
pladdr_t pladdr,
extent_ref_count_t refcount,
- checksum_t checksum)
- : len(len), pladdr(pladdr), refcount(refcount), checksum(checksum) {}
+ checksum_t checksum,
+ extent_types_t type)
+ : len(len), pladdr(pladdr), refcount(refcount),
+ checksum(checksum), type(type) {}
bool operator==(const lba_map_val_t&) const = default;
};
pladdr_le_t pladdr;
extent_ref_count_le_t refcount{0};
checksum_le_t checksum{0};
+ extent_types_le_t type = 0;
lba_map_val_le_t() = default;
lba_map_val_le_t(const lba_map_val_le_t &) = default;
: len(init_extent_len_le(val.len)),
pladdr(pladdr_le_t(val.pladdr)),
refcount(val.refcount),
- checksum(val.checksum) {}
+ checksum(val.checksum),
+ type((extent_types_le_t)val.type) {}
operator lba_map_val_t() const {
- return lba_map_val_t{ len, pladdr, refcount, checksum };
+ return lba_map_val_t{
+ len,
+ pladdr,
+ refcount,
+ checksum,
+ (extent_types_t)type};
}
};
[pos=std::move(pos), c, addr, len](auto &btree) mutable {
auto &cursor = pos.get_effective_cursor();
auto iter = btree.make_partial_iter(c, cursor);
- lba_map_val_t val{len, P_ADDR_ZERO, EXTENT_DEFAULT_REF_COUNT, 0};
+ lba_map_val_t val{
+ len,
+ P_ADDR_ZERO,
+ EXTENT_DEFAULT_REF_COUNT,
+ 0,
+ extent_types_t::NONE};
return btree.insert(c, iter, addr, val
).si_then([c](auto p) {
auto &[iter, inserted] = p;
ext->get_length(),
ext->get_paddr(),
EXTENT_DEFAULT_REF_COUNT,
- ext->get_last_committed_crc()}
+ ext->get_last_committed_crc(),
+ ext->get_type()}
).si_then([ext, c, FNAME, &iter, &ret](auto p) {
auto &[it, inserted] = p;
ceph_assert(inserted);
c,
btree.make_partial_iter(c, cursor),
state.laddr,
- lba_map_val_t{state.len, inter_key, EXTENT_DEFAULT_REF_COUNT, 0});
+ lba_map_val_t{
+ state.len,
+ inter_key,
+ EXTENT_DEFAULT_REF_COUNT,
+ 0,
+ extent_types_t::NONE});
}).si_then([c, &state](auto p) {
auto &[iter, inserted] = p;
auto &leaf_node = *iter.get_leaf_node();
pos = co_await pos.next(c);
continue;
}
- TRACET("tree value {}~{} {}~{} used",
+ TRACET("tree value {}~{} {}~{} used, type {}",
c.trans,
pos.get_key(),
pos.get_val().len,
pos.get_val().pladdr.get_paddr(),
- pos.get_val().len);
+ pos.get_val().len,
+ pos.get_val().type);
ceph_assert(pos.get_val().len > 0 &&
pos.get_val().len % block_size == 0);
ceph_assert(pos.get_val().pladdr != L_ADDR_NULL);
scan_visitor(
pos.get_val().pladdr.get_paddr(),
pos.get_val().len,
- extent_types_t::NONE,
+ pos.get_val().type,
pos.get_key());
pos = co_await pos.next(c);
}
len,
pladdr_t(P_ADDR_ZERO),
EXTENT_DEFAULT_REF_COUNT,
- 0
+ 0,
+ extent_types_t::NONE
}};
}
static alloc_mapping_info_t create_indirect(
len,
pladdr_t(intermediate_key),
EXTENT_DEFAULT_REF_COUNT,
- 0 // crc will only be used and checked with LBA direct mappings
+ 0, // crc will only be used and checked with LBA direct mappings
// also see pin_to_extent(_by_type)
+ extent_types_t::NONE
}};
}
static alloc_mapping_info_t create_direct(
extent_ref_count_t refcount,
checksum_t checksum,
LogicalChildNode& extent) {
- return {laddr, {len, pladdr_t(paddr), refcount, checksum}, &extent};
+ return {
+ laddr,
+ {len,
+ pladdr_t(paddr),
+ refcount,
+ checksum,
+ extent.get_type()},
+ &extent};
}
};
* TODO: update FixedKVNodeLayout to handle the above calculation
* TODO: the above alignment probably isn't portable without further work
*/
-constexpr size_t LEAF_NODE_CAPACITY = 140;
+constexpr size_t LEAF_NODE_CAPACITY = 135;
struct LBALeafNode
: FixedKVLeafNode<
}).unsafe_get();
}
- static auto get_map_val(extent_len_t len) {
- return lba_map_val_t{0, (pladdr_t)P_ADDR_NULL, len, 0};
+ static auto get_map_val(extent_len_t len, extent_types_t type) {
+ return lba_map_val_t{0, (pladdr_t)P_ADDR_NULL, len, 0, type};
}
device_off_t next_off = 0;
void insert(laddr_t addr, extent_len_t len) {
ceph_assert(check.count(addr) == 0);
- check.emplace(addr, get_map_val(len));
+ check.emplace(addr, get_map_val(len, TestBlock::TYPE));
lba_btree_update([=, this](auto &btree, auto &t) {
auto extents = cache->alloc_new_data_extents<TestBlock>(
t,
extents,
[this, addr, len, &t, &btree](auto &extent) {
return btree.insert(
- get_op_context(t), addr, get_map_val(len)
+ get_op_context(t), addr, get_map_val(len, extent->get_type())
).si_then([addr, extent](auto p){
auto& [iter, inserted] = p;
iter.get_leaf_node()->insert_child_ptr(
laddr_t ADDR = get_laddr_hint(0xFF * 4096);
epm->prefill_fragmented_devices();
auto t = create_transaction();
- for (int i = 0; i < 1991; i++) {
+ for (int i = 0; i < 1989; i++) {
auto extents = alloc_extents(t, (ADDR + i * 16384).checked_to_laddr(), 16384, 'a');
}
alloc_extents_deemed_fail(t, (ADDR + 1991 * 16384).checked_to_laddr(), 16384, 'a');