return ret;
}
-eagain_ifuture<> Node::upgrade_root(context_t c, laddr_t hint)
+eagain_ifuture<> Node::upgrade_root(context_t c, laddr_hint_t hint)
{
LOG_PREFIX(OTree::Node::upgrade_root);
assert(impl->field_type() == field_type_t::N0);
}
eagain_ifuture<Ref<InternalNode>> InternalNode::allocate_root(
- context_t c, laddr_t hint, level_t old_root_level,
+ context_t c, laddr_hint_t hint, level_t old_root_level,
laddr_t old_root_addr, Super::URef&& super)
{
// support tree height up to 256
assert(impl->is_level_tail());
assert(impl->field_type() == field_type_t::N0);
Ref<const Node> this_ref = this;
- return InternalNode::allocate(c_other, L_ADDR_MIN, field_type_t::N0, true, impl->level()
+ return InternalNode::allocate(
+ c_other, laddr_hint_t::create_global_md_hint(),
+ field_type_t::N0, true, impl->level()
).si_then([this, c_other, &tracker_other](auto fresh_other) {
impl->test_copy_to(fresh_other.mut);
auto cloned_root = fresh_other.node;
// proceed to split with insert
// assume I'm already ref-counted by caller
- laddr_t left_hint, right_hint;
+ laddr_hint_t left_hint, right_hint;
{
key_view_t left_key;
impl->get_slot(search_position_t::begin(), &left_key, nullptr);
- left_hint = left_key.get_hint();
+ left_hint = left_key.create_onode_hint();
key_view_t right_key;
impl->get_largest_slot(nullptr, &right_key, nullptr);
- right_hint = right_key.get_hint();
+ right_hint = right_key.create_onode_hint();
}
return (is_root() ? upgrade_root(c, left_hint) : eagain_iertr::now()
).si_then([this, c, right_hint] {
}
eagain_ifuture<InternalNode::fresh_node_t> InternalNode::allocate(
- context_t c, laddr_t hint, field_type_t field_type, bool is_level_tail, level_t level)
+ context_t c, laddr_hint_t hint, field_type_t field_type, bool is_level_tail, level_t level)
{
return InternalNodeImpl::allocate(c, hint, field_type, is_level_tail, level
).si_then([](auto&& fresh_impl) {
assert(impl->is_level_tail());
assert(impl->field_type() == field_type_t::N0);
Ref<const Node> this_ref = this;
- return LeafNode::allocate(c_other, L_ADDR_MIN, field_type_t::N0, true
+ return LeafNode::allocate(
+ c_other, laddr_hint_t::create_global_md_hint(), field_type_t::N0, true
).si_then([this, c_other, &tracker_other](auto fresh_other) {
impl->test_copy_to(fresh_other.mut);
auto cloned_root = fresh_other.node;
}
// split and insert
Ref<Node> this_ref = this;
- laddr_t left_hint, right_hint;
+ laddr_hint_t left_hint, right_hint;
{
key_view_t left_key;
impl->get_slot(search_position_t::begin(), &left_key, nullptr);
- left_hint = left_key.get_hint();
+ left_hint = left_key.create_onode_hint();
key_view_t right_key;
impl->get_largest_slot(nullptr, &right_key, nullptr);
- right_hint = right_key.get_hint();
+ right_hint = right_key.create_onode_hint();
}
return (is_root() ? upgrade_root(c, left_hint) : eagain_iertr::now()
).si_then([this, c, right_hint] {
context_t c, RootNodeTracker& root_tracker)
{
LOG_PREFIX(OTree::LeafNode::allocate_root);
- return LeafNode::allocate(c, L_ADDR_MIN, field_type_t::N0, true
+ return LeafNode::allocate(
+ c, laddr_hint_t::create_global_md_hint(), field_type_t::N0, true
).si_then([c, &root_tracker, FNAME](auto fresh_node) {
auto root = fresh_node.node;
return c.nm.get_super(c.t, root_tracker
}
eagain_ifuture<LeafNode::fresh_node_t> LeafNode::allocate(
- context_t c, laddr_t hint, field_type_t field_type, bool is_level_tail)
+ context_t c, laddr_hint_t hint, field_type_t field_type, bool is_level_tail)
{
return LeafNodeImpl::allocate(c, hint, field_type, is_level_tail
).si_then([](auto&& fresh_impl) {
make_root(c, std::move(_super));
}
void as_root(Super::URef&& _super);
- eagain_ifuture<> upgrade_root(context_t, laddr_t);
+ eagain_ifuture<> upgrade_root(context_t, laddr_hint_t);
Super::URef deref_super();
void track_make_tail(const search_position_t&);
static eagain_ifuture<Ref<InternalNode>> allocate_root(
- context_t, laddr_t, level_t, laddr_t, Super::URef&&);
+ context_t, laddr_hint_t, level_t, laddr_t, Super::URef&&);
protected:
eagain_ifuture<Ref<tree_cursor_t>> lookup_smallest(context_t) override;
return std::make_pair(Ref<Node>(node), mut);
}
};
- static eagain_ifuture<fresh_node_t> allocate(context_t, laddr_t, field_type_t, bool, level_t);
+ static eagain_ifuture<fresh_node_t> allocate(context_t, laddr_hint_t, field_type_t, bool, level_t);
private:
/**
return std::make_pair(Ref<Node>(node), mut);
}
};
- static eagain_ifuture<fresh_node_t> allocate(context_t, laddr_t, field_type_t, bool);
+ static eagain_ifuture<fresh_node_t> allocate(context_t, laddr_hint_t, field_type_t, bool);
private:
/**
std::memcpy(to.get_write(), extent->get_read(), get_length());
}
- eagain_ifuture<NodeExtentMutable> rebuild(context_t c, laddr_t hint) {
+ eagain_ifuture<NodeExtentMutable> rebuild(context_t c, laddr_hint_t hint) {
LOG_PREFIX(OTree::Extent::rebuild);
assert(!is_retired());
if (state == nextent_state_t::FRESH) {
using alloc_iertr = base_iertr;
virtual alloc_iertr::future<NodeExtentRef> alloc_extent(
- Transaction&, laddr_t hint, extent_len_t) = 0;
+ Transaction&, laddr_hint_t hint, extent_len_t) = 0;
using retire_iertr = base_iertr::extend<
crimson::ct_error::enoent>;
}
alloc_iertr::future<NodeExtentRef> alloc_extent(
- Transaction& t, laddr_t hint, extent_len_t len) override {
+ Transaction& t, laddr_hint_t hint, extent_len_t len) override {
SUBTRACET(seastore_onode, "allocating {}B with hint {} ...", t, len, hint);
if constexpr (SYNC) {
return alloc_extent_sync(t, len);
}
alloc_iertr::future<NodeExtentRef> alloc_extent(
- Transaction& t, laddr_t hint, extent_len_t len) override {
+ Transaction& t, laddr_hint_t hint, extent_len_t len) override {
SUBTRACET(seastore_onode, "allocating {}B with hint {} ...", t, len, hint);
if constexpr (INJECT_EAGAIN) {
if (trigger_eagain()) {
// XXX: branchless allocation
eagain_ifuture<InternalNodeImpl::fresh_impl_t>
InternalNodeImpl::allocate(
- context_t c, laddr_t hint, field_type_t type, bool is_level_tail, level_t level)
+ context_t c, laddr_hint_t hint, field_type_t type, bool is_level_tail, level_t level)
{
if (type == field_type_t::N0) {
return InternalNode0::allocate(c, hint, is_level_tail, level);
eagain_ifuture<LeafNodeImpl::fresh_impl_t>
LeafNodeImpl::allocate(
- context_t c, laddr_t hint, field_type_t type, bool is_level_tail)
+ context_t c, laddr_hint_t hint, field_type_t type, bool is_level_tail)
{
if (type == field_type_t::N0) {
return LeafNode0::allocate(c, hint, is_level_tail, 0);
return {std::move(impl), mut};
}
};
- static eagain_ifuture<fresh_impl_t> allocate(context_t, laddr_t, field_type_t, bool, level_t);
+ static eagain_ifuture<fresh_impl_t> allocate(context_t, laddr_hint_t, field_type_t, bool, level_t);
static InternalNodeImplURef load(NodeExtentRef, field_type_t);
return {std::move(impl), mut};
}
};
- static eagain_ifuture<fresh_impl_t> allocate(context_t, laddr_t, field_type_t, bool);
+ static eagain_ifuture<fresh_impl_t> allocate(context_t, laddr_hint_t, field_type_t, bool);
static LeafNodeImplURef load(NodeExtentRef, field_type_t);
}
static eagain_ifuture<typename parent_t::fresh_impl_t> allocate(
- context_t c, laddr_t hint, bool is_level_tail, level_t level) {
+ context_t c, laddr_hint_t hint, bool is_level_tail, level_t level) {
LOG_PREFIX(OTree::Layout::allocate);
extent_len_t extent_size;
if constexpr (NODE_TYPE == node_type_t::LEAF) {
key_view_t first_index;
stage_t::template get_slot<true, false>(
extent.read(), position_t::begin(), &first_index, nullptr);
- auto hint = first_index.get_hint();
+ auto hint = first_index.create_onode_hint();
return extent.rebuild(c, hint).si_then([this] (auto mut) {
// addr may change
build_name();
void initialize(Transaction& t, Onode& value) const {
auto &ftvalue = static_cast<FLTreeOnode&>(value);
ftvalue.update_onode_size(t, size);
- auto oroot = omap_root_t(laddr_t::from_raw_uint(id), cnt_modify,
+ auto laddr = laddr_t::from_byte_offset(id << laddr_t::UNIT_SHIFT);
+ auto oroot = omap_root_t(laddr, cnt_modify,
value.get_metadata_hint(block_size), omap_type_t::OMAP);
ftvalue.update_omap_root(t, oroot);
validate(value);
void validate(Onode& value) const {
auto& layout = value.get_layout();
ceph_assert(uint64_t(layout.size) == uint64_t{size});
- ceph_assert(layout.omap_root.get(value.get_metadata_hint(block_size)).addr == laddr_t::from_raw_uint(id));
+ auto laddr = laddr_t::from_byte_offset(id << laddr_t::UNIT_SHIFT);
+ ceph_assert(layout.omap_root.get(value.get_metadata_hint(block_size)).addr == laddr);
ceph_assert(layout.omap_root.get(value.get_metadata_hint(block_size)).depth == cnt_modify);
}
} \
)
-#define INTR_WITH_PARAM(fun, c, b, v) \
- with_trans_intr( \
- c.t, \
- [=] (auto &t) { \
- return fun(c, L_ADDR_MIN, b, v); \
- } \
+#define INTR_WITH_PARAM(fun, c, b, v) \
+ with_trans_intr( \
+ c.t, \
+ [=] (auto &t) { \
+ laddr_hint_t hint; \
+ hint.addr = L_ADDR_MIN; \
+ hint.condition = \
+ laddr_conflict_condition_t::all_at_object_content; \
+ hint.policy = \
+ laddr_conflict_policy_t::linear_search; \
+ return fun(c, hint, b, v); \
+ } \
)
namespace {
crimson::ct_error::assert_all{"Invalid error during create_initial()"}
).si_then([c, initial](auto super) {
initial->make_root_new(c, std::move(super));
- return initial->upgrade_root(c, L_ADDR_MIN).si_then([initial] {
+ laddr_hint_t hint;
+ hint.addr = L_ADDR_MIN;
+ hint.condition = laddr_conflict_condition_t::all_at_object_content;
+ hint.policy = laddr_conflict_policy_t::linear_search;
+ hint.block_size = laddr_t::UNIT_SIZE;
+ return initial->upgrade_root(c, hint).si_then([initial] {
return initial;
});
});