return (mt->ma_flags & MT_FLAGS_HEIGHT_MASK) >> MT_FLAGS_HEIGHT_OFFSET;
}
-
static void mas_set_height(struct ma_state *mas)
{
unsigned int new_flags = mas->tree->ma_flags;
p_type &= MAPLE_NODE_MASK;
p_type = p_type & ~(MAPLE_PARENT_ROOT | mte_parent_slot_mask(p_type));
-
switch (p_type) {
case MAPLE_PARENT_RANGE64: /* or MAPLE_PARENT_ARANGE64 */
if (mt_is_alloc(mt))
(mte_to_node(enode)->parent) & ~MAPLE_NODE_MASK);
}
-
/*
* ma_dead_node() - check if the @enode is dead.
* @enode: The encoded maple node
unsigned char offset;
bool set_max = false, set_min = false;
-
a_node = mas_mn(mas);
if (ma_is_root(a_node)) {
mas->offset = 0;
if (unlikely(!root))
goto done;
-
if (likely(xa_is_node(root))) {
mas->node = mte_safe_root(root);
} else {
if (likely(!pivots[offset]))
return ma_meta_end(node, type);
-
if (likely(pivots[offset] == max))
return offset;
if (likely(!pivots[offset]))
return ma_meta_end(node, type);
-
if (likely(pivots[offset] == mas->max))
return offset;
unsigned char offset = 0;
void __rcu **slots = NULL;
-
if (ma_is_root(mn)) {
old_enode = mas_root_locked(mas);
} else {
}
next[0] = *mas;
-
while (!mte_is_leaf(list[0].node)) {
n = 0;
for (i = 0; i < 3; i++) {
void __rcu **slots;
struct ma_wr_state wr_mas;
-
wr_mas.mas = mast->orig_l;
wr_mas.type = mte_node_type(mast->orig_l->node);
/* The left node is consumed, so add to the free list. */
mas_ascend(mast->orig_l);
mas_ascend(mast->orig_r);
mat_add(mast->free, left);
+
if (left != right)
mat_add(mast->free, right);
if (mas_is_root_limits(mast->orig_l))
break;
-
/* Try to get enough data for the next iteration. */
if (!mast_sibling_rebalance_right(mast, true))
if (!mast_cousin_rebalance_right(mast, true))
if (mas_is_err(mas))
return 0;
-
mast.orig_l = &l_mas;
mast.orig_r = &r_mas;
mast.bn = b_node;
ma_set_meta(new_left, mt, 0, split);
l_mas.node = mt_mk_node(new_left, mt);
-
/* replace parent. */
offset = mte_parent_slot(mas->node);
mt = mas_parent_enum(&l_mas, l_mas.node);
unsigned long *pivots;
int slot = 0;
-
mas_node_count(mas, 1);
if (unlikely(mas_is_err(mas)))
return 0;
return slot;
}
-
static inline void mas_store_root(struct ma_state *mas, void *entry)
{
if (likely((mas->last != 0) || (mas->index != 0)))
enum maple_type type = wr_mas->type;
void *entry = wr_mas->entry;
-
/* Contained in this pivot */
if (piv > last)
return false;
} while (!mas_is_none(&mas));
}
+
/*
* validate a maple tree by checking:
* 1. The limits (pivots are within mas->min to mas->max)
rcu_read_unlock();
}
+
#endif /* CONFIG_DEBUG_MAPLE_TREE */