*
* Future will not resolve until all pins have resolved (set_paddr called)
*/
- using get_mapping_ertr = base_ertr;
- using get_mapping_ret = get_mapping_ertr::future<lba_pin_list_t>;
- virtual get_mapping_ret get_mapping(
+ using get_mappings_ertr = base_ertr;
+ using get_mappings_ret = get_mappings_ertr::future<lba_pin_list_t>;
+ virtual get_mappings_ret get_mappings(
Transaction &t,
laddr_t offset, extent_len_t length) = 0;
/**
- * Fetches mappings for laddr_t in range [offset, offset + len)
+ * Fetches mappings for a list of laddr_t in range [offset, offset + len)
*
- * Future will not result until all pins have resolved (set_paddr called)
+ * Future will not resolve until all pins have resolved (set_paddr called)
*/
- using get_mappings_ertr = base_ertr;
- using get_mappings_ret = get_mapping_ertr::future<lba_pin_list_t>;
virtual get_mappings_ret get_mappings(
Transaction &t,
laddr_list_t &&extent_lisk) = 0;
+ /**
+ * Fetches the mapping for laddr_t
+ *
+ * Future will not resolve until the pin has resolved (set_paddr called)
+ */
+ using get_mapping_ertr = base_ertr::extend<
+ crimson::ct_error::enoent>;
+ using get_mapping_ret = get_mapping_ertr::future<LBAPinRef>;
+ virtual get_mapping_ret get_mapping(
+ Transaction &t,
+ laddr_t offset) = 0;
+
/**
* Finds unmapped laddr extent of len len
*/
});
}
-BtreeLBAManager::get_mapping_ret
-BtreeLBAManager::get_mapping(
+BtreeLBAManager::get_mappings_ret
+BtreeLBAManager::get_mappings(
Transaction &t,
laddr_t offset, extent_len_t length)
{
- logger().debug("BtreeLBAManager::get_mapping: {}, {}", offset, length);
+ logger().debug("BtreeLBAManager::get_mappings: {}, {}", offset, length);
return get_root(
t).safe_then([this, &t, offset, length](auto extent) {
return extent->lookup_range(
offset, length
).safe_then([extent](auto ret) { return ret; });
}).safe_then([](auto &&e) {
- logger().debug("BtreeLBAManager::get_mapping: got mapping {}", e);
- return get_mapping_ret(
- get_mapping_ertr::ready_future_marker{},
+ logger().debug("BtreeLBAManager::get_mappings: got mappings {}", e);
+ return get_mappings_ret(
+ get_mappings_ertr::ready_future_marker{},
std::move(e));
});
}
l->begin(),
l->end(),
[this, &t, &ret](const auto &p) {
- return get_mapping(t, p.first, p.second).safe_then(
+ return get_mappings(t, p.first, p.second).safe_then(
[&ret](auto res) {
ret.splice(ret.end(), res, res.begin(), res.end());
});
});
}
+BtreeLBAManager::get_mapping_ret
+BtreeLBAManager::get_mapping(
+ Transaction &t,
+ laddr_t offset)
+{
+ ceph_abort("not implemented");
+}
+
BtreeLBAManager::find_hole_ret
BtreeLBAManager::find_hole(
Transaction &t,
mkfs_ret mkfs(
Transaction &t) final;
- get_mapping_ret get_mapping(
+ get_mappings_ret get_mappings(
Transaction &t,
laddr_t offset, extent_len_t length) final;
Transaction &t,
laddr_list_t &&list) final;
+ get_mapping_ret get_mapping(
+ Transaction &t,
+ laddr_t offset) final;
+
find_hole_ret find_hole(
Transaction &t,
laddr_t hint,
*/
struct LBANode : CachedExtent {
using LBANodeRef = TCachedExtentRef<LBANode>;
- using lookup_range_ertr = LBAManager::get_mapping_ertr;
- using lookup_range_ret = LBAManager::get_mapping_ret;
+ using lookup_range_ertr = LBAManager::get_mappings_ertr;
+ using lookup_range_ret = LBAManager::get_mappings_ret;
btree_range_pin_t pin;
}
if (is_logical_type(type)) {
- return lba_manager->get_mapping(
+ // TODO: switch to get_mapping()
+ return lba_manager->get_mappings(
t,
laddr,
len).safe_then([=, &t](lba_pin_list_t pins) {
*
* Get logical pins overlapping offset~length
*/
- using get_pins_ertr = LBAManager::get_mapping_ertr;
+ using get_pins_ertr = LBAManager::get_mappings_ertr;
using get_pins_ret = get_pins_ertr::future<lba_pin_list_t>;
get_pins_ret get_pins(
Transaction &t,
laddr_t offset,
extent_len_t length) {
- return lba_manager->get_mapping(
+ return lba_manager->get_mappings(
t, offset, length);
}
void check_mappings(test_transaction_t &t) {
for (auto &&i: t.mappings) {
- auto ret_list = lba_manager->get_mapping(
+ auto ret_list = lba_manager->get_mappings(
*t.t, i.first, i.second.len
).unsafe_get0();
EXPECT_EQ(ret_list.size(), 1);
EXPECT_EQ(i.second.addr, ret->get_paddr());
EXPECT_EQ(i.first, ret->get_laddr());
EXPECT_EQ(i.second.len, ret->get_length());
+ // TODO: test get_mapping()
}
lba_manager->scan_mappings(
*t.t,