mirror of
https://github.com/ceph/ceph
synced 2025-02-22 02:27:29 +00:00
crimson/seastore: add stub to introduce get_mapping() without length
Signed-off-by: Yingxin Cheng <yingxin.cheng@intel.com>
This commit is contained in:
parent
c25d8e977e
commit
6f4b296056
@ -42,23 +42,33 @@ public:
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
@ -59,12 +59,12 @@ BtreeLBAManager::get_root(Transaction &t)
|
||||
});
|
||||
}
|
||||
|
||||
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(
|
||||
@ -72,9 +72,9 @@ BtreeLBAManager::get_mapping(
|
||||
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));
|
||||
});
|
||||
}
|
||||
@ -93,7 +93,7 @@ BtreeLBAManager::get_mappings(
|
||||
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());
|
||||
});
|
||||
@ -102,6 +102,14 @@ BtreeLBAManager::get_mappings(
|
||||
});
|
||||
}
|
||||
|
||||
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,
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
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;
|
||||
|
||||
@ -58,6 +58,10 @@ public:
|
||||
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,
|
||||
|
@ -50,8 +50,8 @@ using BtreeLBAPinRef = std::unique_ptr<BtreeLBAPin>;
|
||||
*/
|
||||
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;
|
||||
|
||||
|
@ -321,7 +321,8 @@ TransactionManager::get_extent_if_live_ret TransactionManager::get_extent_if_liv
|
||||
}
|
||||
|
||||
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) {
|
||||
|
@ -126,13 +126,13 @@ public:
|
||||
*
|
||||
* 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);
|
||||
}
|
||||
|
||||
|
@ -272,7 +272,7 @@ struct btree_lba_manager_test :
|
||||
|
||||
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);
|
||||
@ -280,6 +280,7 @@ struct btree_lba_manager_test :
|
||||
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,
|
||||
|
Loading…
Reference in New Issue
Block a user