unsigned long mt_max[] = {
[maple_dense] = MAPLE_NODE_SLOTS,
- [maple_sparse_6] = (1UL << 6) - 1,
- [maple_sparse_9] = (1UL << 9) - 1,
- [maple_sparse_16] = (1UL << 16) - 1,
- [maple_sparse_21] = (1UL << 21) - 1,
- [maple_sparse_32] = UINT_MAX,
- [maple_sparse_64] = ULONG_MAX,
- [maple_leaf_16] = (1UL << 16) - 1,
- [maple_leaf_32] = UINT_MAX,
[maple_leaf_64] = ULONG_MAX,
- [maple_range_16] = (1UL << 16) - 1,
- [maple_range_32] = UINT_MAX,
[maple_range_64] = ULONG_MAX,
[maple_arange_64] = ULONG_MAX,
};
unsigned char mt_slots[] = {
[maple_dense] = MAPLE_NODE_SLOTS,
- [maple_sparse_6] = MAPLE_SPARSE6_SLOTS,
- [maple_sparse_9] = MAPLE_SPARSE9_SLOTS,
- [maple_sparse_16] = MAPLE_SPARSE16_SLOTS,
- [maple_sparse_21] = MAPLE_SPARSE21_SLOTS,
- [maple_sparse_32] = MAPLE_SPARSE32_SLOTS,
- [maple_sparse_64] = MAPLE_SPARSE64_SLOTS,
- [maple_leaf_16] = MAPLE_RANGE16_SLOTS,
- [maple_leaf_32] = MAPLE_RANGE32_SLOTS,
[maple_leaf_64] = MAPLE_RANGE64_SLOTS,
- [maple_range_16] = MAPLE_RANGE16_SLOTS,
- [maple_range_32] = MAPLE_RANGE32_SLOTS,
[maple_range_64] = MAPLE_RANGE64_SLOTS,
[maple_arange_64] = MAPLE_ARANGE64_SLOTS,
};
unsigned char mt_pivots[] = {
[maple_dense] = 0,
- [maple_sparse_6] = 1,
- [maple_sparse_9] = MAPLE_SPARSE9_SLOTS - 1,
- [maple_sparse_16] = MAPLE_SPARSE16_SLOTS - 1,
- [maple_sparse_21] = MAPLE_SPARSE21_SLOTS - 1,
- [maple_sparse_32] = MAPLE_SPARSE32_SLOTS - 1,
- [maple_sparse_64] = MAPLE_SPARSE64_SLOTS - 1,
- [maple_leaf_16] = MAPLE_RANGE16_SLOTS - 1,
- [maple_leaf_32] = MAPLE_RANGE32_SLOTS - 1,
[maple_leaf_64] = MAPLE_RANGE64_SLOTS - 1,
- [maple_range_16] = MAPLE_RANGE16_SLOTS - 1,
- [maple_range_32] = MAPLE_RANGE32_SLOTS - 1,
[maple_range_64] = MAPLE_RANGE64_SLOTS - 1,
[maple_arange_64] = MAPLE_ARANGE64_SLOTS - 1,
};
unsigned char mt_min_slots[] = {
[maple_dense] = MAPLE_NODE_SLOTS / 2,
- [maple_sparse_6] = MAPLE_SPARSE6_SLOTS / 2,
- [maple_sparse_9] = MAPLE_SPARSE9_SLOTS / 2,
- [maple_sparse_16] = MAPLE_SPARSE16_SLOTS / 2,
- [maple_sparse_21] = MAPLE_SPARSE21_SLOTS / 2,
- [maple_sparse_32] = MAPLE_SPARSE32_SLOTS / 2,
- [maple_sparse_64] = MAPLE_SPARSE64_SLOTS / 2,
- [maple_leaf_16] = MAPLE_RANGE16_SLOTS / 2,
- [maple_leaf_32] = MAPLE_RANGE32_SLOTS / 2,
[maple_leaf_64] = (MAPLE_RANGE64_SLOTS / 2) - 2,
- [maple_range_16] = MAPLE_RANGE16_SLOTS / 2,
- [maple_range_32] = MAPLE_RANGE32_SLOTS / 2,
[maple_range_64] = (MAPLE_RANGE64_SLOTS / 2) - 2,
#if defined(NODE256)
[maple_arange_64] = (MAPLE_ARANGE64_SLOTS / 2) - 2,
static inline bool ma_is_dense(const enum maple_type type)
{
- return type < maple_sparse_6;
-}
-
-static inline bool mte_is_dense(const struct maple_enode *entry)
-{
- return ma_is_dense(mte_node_type(entry));
+ return type < maple_leaf_64;
}
static inline bool ma_is_leaf(const enum maple_type type)
{
- return type < maple_range_16;
+ return type < maple_range_64;
}
static inline bool mte_is_leaf(const struct maple_enode *entry)
return ((unsigned long)entry < 4096) && xa_is_internal(entry);
}
-static inline bool mt_is_empty(const void *entry)
-{
- return !entry;
-}
-
static inline void mas_set_err(struct ma_state *mas, long err)
{
mas->node = MA_ERROR(err);
static inline enum maple_type mte_parent_range_enum(unsigned long parent)
{
- switch (parent) {
- case 6:
+ if (parent)
return maple_range_64;
- case 4:
- return maple_range_32;
- case 0:
- return maple_range_16;
- }
+
return maple_dense;
}
static inline enum maple_type mte_parent_alloc_enum(unsigned long parent)
{
- switch (parent) {
- case 6:
+ if (parent)
return maple_arange_64;
- }
+
return maple_dense;
}
case maple_range_64:
case maple_arange_64:
type |= 4;
- fallthrough;
- case maple_range_32:
type |= 2;
break;
- case maple_range_16:
- slot_shift = 2;
- break;
default:
break;
}
case maple_range_64:
case maple_leaf_64:
return mn->mr64.pivot[piv];
- case maple_sparse_6:
- return mn->ms6.pivot;
- case maple_sparse_9:
- return mn->ms9.pivot[piv];
- case maple_sparse_16:
- return mn->ms16.pivot[piv];
- case maple_sparse_21:
- return mn->ms21.pivot[piv];
- case maple_sparse_32:
- return mn->ms32.pivot[piv];
- case maple_sparse_64:
- return mn->ms64.pivot[piv];
- case maple_range_16:
- case maple_leaf_16:
- return mn->mr16.pivot[piv];
- case maple_range_32:
- case maple_leaf_32:
- return mn->mr32.pivot[piv];
case maple_dense:
default:
return 0;
(&mn->ma64)->pivot[piv] = val;
case maple_dense:
break;
- case maple_sparse_6:
- (&mn->ms6)->pivot = val;
- break;
- case maple_sparse_9:
- (&mn->ms9)->pivot[piv] = val;
- break;
- case maple_sparse_16:
- (&mn->ms16)->pivot[piv] = val;
- break;
- case maple_sparse_21:
- (&mn->ms21)->pivot[piv] = val;
- break;
- case maple_sparse_32:
- (&mn->ms32)->pivot[piv] = val;
- break;
- case maple_sparse_64:
- (&mn->ms64)->pivot[piv] = val;
- break;
- case maple_range_16:
- case maple_leaf_16:
- (&mn->mr16)->pivot[piv] = val;
- break;
- case maple_range_32:
- case maple_leaf_32:
- (&mn->mr32)->pivot[piv] = val;
- break;
}
}
return mn->mr64.slot;
case maple_dense:
return mn->slot;
- case maple_sparse_6:
- return mn->ms6.slot;
- case maple_sparse_9:
- return mn->ms9.slot;
- case maple_sparse_16:
- return mn->ms16.slot;
- case maple_sparse_21:
- return mn->ms21.slot;
- case maple_sparse_32:
- return mn->ms32.slot;
- case maple_sparse_64:
- return mn->ms64.slot;
- case maple_range_16:
- case maple_leaf_16:
- return mn->mr16.slot;
- case maple_range_32:
- case maple_leaf_32:
- return mn->mr32.slot;
- }
-}
-
-static inline struct maple_enode *ma_get_rcu_slot(
+ }
+}
+
+static inline struct maple_enode *ma_get_slot(
const struct maple_node *mn, unsigned char slot,
enum maple_type type, struct maple_tree *mtree)
{
switch (type) {
+ default:
+ case maple_arange_64:
+ return rcu_dereference_check(mn->ma64.slot[slot],
+ lockdep_is_held(&mtree->ma_lock));
case maple_range_64:
case maple_leaf_64:
return rcu_dereference_check(mn->mr64.slot[slot],
lockdep_is_held(&mtree->ma_lock));
- default:
case maple_dense:
return rcu_dereference_check(mn->slot[slot],
lockdep_is_held(&mtree->ma_lock));
- case maple_arange_64:
- return rcu_dereference_check(mn->ma64.slot[slot],
- lockdep_is_held(&mtree->ma_lock));
- case maple_sparse_6:
- return rcu_dereference_check(mn->ms6.slot[slot],
- lockdep_is_held(&mtree->ma_lock));
- case maple_sparse_9:
- return rcu_dereference_check(mn->ms9.slot[slot],
- lockdep_is_held(&mtree->ma_lock));
- case maple_sparse_16:
- return rcu_dereference_check(mn->ms16.slot[slot],
- lockdep_is_held(&mtree->ma_lock));
- case maple_sparse_21:
- return rcu_dereference_check(mn->ms21.slot[slot],
- lockdep_is_held(&mtree->ma_lock));
- case maple_sparse_32:
- return rcu_dereference_check(mn->ms32.slot[slot],
- lockdep_is_held(&mtree->ma_lock));
- case maple_sparse_64:
- return rcu_dereference_check(mn->ms64.slot[slot],
- lockdep_is_held(&mtree->ma_lock));
- case maple_range_16:
- case maple_leaf_16:
- return rcu_dereference_check(mn->mr16.slot[slot],
- lockdep_is_held(&mtree->ma_lock));
- case maple_range_32:
- case maple_leaf_32:
- return rcu_dereference_check(mn->mr32.slot[slot],
- lockdep_is_held(&mtree->ma_lock));
}
}
-static inline struct maple_enode *_mte_get_rcu_slot(
+static inline struct maple_enode *_mte_get_slot(
const struct maple_enode *mn, unsigned char slot,
enum maple_type type, struct maple_tree *mtree)
{
- return ma_get_rcu_slot(mte_to_node(mn), slot, type, mtree);
+ return ma_get_slot(mte_to_node(mn), slot, type, mtree);
}
-static inline struct maple_enode *mte_get_rcu_slot(const struct maple_enode *mn,
+static inline struct maple_enode *mte_get_slot(const struct maple_enode *mn,
unsigned char slot, struct maple_tree *mtree)
{
- return _mte_get_rcu_slot(mn, slot, mte_node_type(mn), mtree);
+ return _mte_get_slot(mn, slot, mte_node_type(mn), mtree);
}
-static inline struct maple_enode *mas_get_rcu_slot(const struct ma_state *mas,
+static inline struct maple_enode *mas_get_slot(const struct ma_state *mas,
unsigned char slot)
{
- return mte_get_rcu_slot(mas->node, slot, mas->tree);
+ return mte_get_slot(mas->node, slot, mas->tree);
}
/*
- * ma_set_rcu_slot() - Set a nodes rcu slot.
+ * ma_set_slot() - Set a nodes rcu slot.
*
* @mn - the maple node for the operation
* @slot - the slot number to set
* @type - the maple node type
* @val - the value to store
*/
-static inline void ma_set_rcu_slot(struct maple_node *mn,
+static inline void ma_set_slot(struct maple_node *mn,
unsigned char slot, enum maple_type type, void *val)
{
BUG_ON(slot >= mt_slots[type]);
switch (type) {
default:
- case maple_dense:
- rcu_assign_pointer(mn->slot[slot], val);
- break;
- case maple_sparse_6:
- rcu_assign_pointer(mn->ms6.slot[slot], val);
- break;
- case maple_sparse_9:
- rcu_assign_pointer(mn->ms9.slot[slot], val);
- break;
- case maple_sparse_16:
- rcu_assign_pointer(mn->ms16.slot[slot], val);
- break;
- case maple_sparse_21:
- rcu_assign_pointer(mn->ms21.slot[slot], val);
- break;
- case maple_sparse_32:
- rcu_assign_pointer(mn->ms32.slot[slot], val);
- break;
- case maple_sparse_64:
- rcu_assign_pointer(mn->ms64.slot[slot], val);
- break;
- case maple_range_16:
- case maple_leaf_16:
- rcu_assign_pointer(mn->mr16.slot[slot], val);
- break;
- case maple_range_32:
- case maple_leaf_32:
- rcu_assign_pointer(mn->mr32.slot[slot], val);
- break;
case maple_range_64:
case maple_leaf_64:
rcu_assign_pointer(mn->mr64.slot[slot], val);
case maple_arange_64:
rcu_assign_pointer(mn->ma64.slot[slot], val);
break;
+ case maple_dense:
+ rcu_assign_pointer(mn->slot[slot], val);
+ break;
}
}
/*
- * mte_set_rcu_slot() - Set an encoded nodes rcu slot.
+ * mte_set_slot() - Set an encoded nodes rcu slot.
*/
-static inline void mte_set_rcu_slot(const struct maple_enode *mn,
+static inline void mte_set_slot(const struct maple_enode *mn,
unsigned char slot, void *val)
{
- ma_set_rcu_slot(mte_to_node(mn), slot, mte_node_type(mn), val);
+ ma_set_slot(mte_to_node(mn), slot, mte_node_type(mn), val);
}
/*
if (slot)
mas->min = mas_safe_pivot(mas, slot - 1) + 1;
mas->max = mas_safe_pivot(mas, slot);
- mas->node = mas_get_rcu_slot(mas, mas_offset(mas));
+ mas->node = mas_get_slot(mas, mas_offset(mas));
}
static inline unsigned long ma_get_gap(const struct maple_node *mn,
if (ma_is_dense(mt)) {
for (i = 0; i < mt_slot_count(mas->node); i++) {
- entry = mas_get_rcu_slot(mas, i);
- if (!mt_is_empty(entry)) {
+ entry = mas_get_slot(mas, i);
+ if (entry) {
if (gap > max_gap)
max_gap = gap;
gap = 0;
pend = mas->max;
gap = pend - pstart + 1;
- entry = mas_get_rcu_slot(mas, i);
+ entry = mas_get_slot(mas, i);
- if (!mt_is_empty(entry))
+ if (entry)
goto next;
if (gap > max_gap)
if (pivot > limit)
goto no_entry;
- mn = mas_get_rcu_slot(mas, slot);
+ mn = mas_get_slot(mas, slot);
- if (mt_is_empty(mn)) {
+ if (!mn) {
min = pivot + 1;
continue;
}
_mte_get_pivot(parent, slot, type) == 0)
break;
- child = _mte_get_rcu_slot(parent, slot, type, mas->tree);
- if (!mt_is_empty(child))
+ child = _mte_get_slot(parent, slot, type, mas->tree);
+ if (child)
mte_set_parent(child, parent, slot);
}
}
parent = mt_mk_node(mte_parent(mas->node), ptype);
slot = mte_parent_slot(mas->node);
- prev = mte_get_rcu_slot(parent, slot, mas->tree);
+ prev = mte_get_slot(parent, slot, mas->tree);
}
if (mte_to_node(prev) == mn)
rcu_assign_pointer(mas->tree->ma_root, mte_mk_root(mas->node));
mas_set_height(mas);
} else {
- mte_set_rcu_slot(parent, slot, mas->node);
+ mte_set_slot(parent, slot, mas->node);
}
if (!advanced)
struct maple_enode *entry;
for (slot = mas_offset(mas); slot < end; slot++) {
- entry = mas_get_rcu_slot(mas, slot);
+ entry = mas_get_slot(mas, slot);
if (!entry) // end of node data.
break;
int i, j;
for (i = mas_start, j = mab_start; i <= mas_end; i++, j++) {
- b_node->slot[j] = mas_get_rcu_slot(mas, i);
+ b_node->slot[j] = mas_get_slot(mas, i);
if (!mte_is_leaf(mas->node) && mt_is_alloc(mas->tree))
b_node->gap[j] = mte_get_gap(mas->node, i);
break;
mas->max = b_node->pivot[i];
- mte_set_rcu_slot(mas->node, j, b_node->slot[i]);
+ mte_set_slot(mas->node, j, b_node->slot[i]);
if (j < mt_pivot_count(mas->node))
mte_set_pivot(mas->node, j, b_node->pivot[i]);
{
unsigned char slot = mas_offset(mas);
unsigned char end = mas_data_end(mas);
- void *contents = mas_get_rcu_slot(mas, slot);
+ void *contents = mas_get_slot(mas, slot);
unsigned char b_end = 0;
// Possible underflow of piv will wrap back to 0 before use.
unsigned long piv = mas->min - 1;
if (mast->orig_l->node == mast->orig_r->node) {
for (slot = l_slot + 1; slot < r_slot; slot++)
mat_add(mast->destroy,
- mas_get_rcu_slot(mast->orig_l, slot));
+ mas_get_slot(mast->orig_l, slot));
return;
}
/* mast->orig_r is different and consumed. */
/* Now destroy l_slot + 1 -> end and 0 -> r_slot - 1 */
end = mas_data_end(mast->orig_l);
for (slot = l_slot + 1; slot <= end; slot++)
- mat_add(mast->destroy, mas_get_rcu_slot(mast->orig_l, slot));
+ mat_add(mast->destroy, mas_get_slot(mast->orig_l, slot));
for (slot = 0; slot < r_slot; slot++)
- mat_add(mast->destroy, mas_get_rcu_slot(mast->orig_r, slot));
+ mat_add(mast->destroy, mas_get_slot(mast->orig_r, slot));
}
static inline void mast_rebalance_next(struct maple_subtree_state *mast,
// Zero end of node.
if (end > bn->b_end) {
for (i = bn->b_end + 1; i < mt_slot_count(mas->node); i++) {
- mte_set_rcu_slot(mas->node, i, NULL);
+ mte_set_slot(mas->node, i, NULL);
if (i < mt_pivot_count(mas->node))
mte_set_pivot(mas->node, i, 0);
((unsigned long)mas->tree | MA_ROOT_PARENT));
if (contents)
- mte_set_rcu_slot(mas->node, slot++, contents);
+ mte_set_slot(mas->node, slot++, contents);
if (!mas->index && slot)
slot--;
else if (mas->index > 1)
mte_set_pivot(mas->node, slot++, mas->index - 1);
- mte_set_rcu_slot(mas->node, slot, entry);
+ mte_set_slot(mas->node, slot, entry);
mte_set_pivot(mas->node, slot++, mas->last);
/* swap the new root into the tree */
rcu_assign_pointer(mas->tree->ma_root, mte_mk_root(mas->node));
else
mas->full_cnt = 0;
- next = mas_get_rcu_slot(mas, mas_offset(mas));
+ next = mas_get_slot(mas, mas_offset(mas));
// Traverse.
mas->max = *range_max;
mas->min = *range_min;
- if (unlikely(mt_is_empty(next)))
+ if (unlikely(!next))
return false;
mas->node = next;
unsigned char l_slot = mas_offset(l_mas);
unsigned char r_slot = mas_offset(r_mas);
unsigned char cp_r_slot = r_slot;
- void *content = mas_get_rcu_slot(l_mas, l_slot);
+ void *content = mas_get_slot(l_mas, l_slot);
unsigned long range_max = mas_safe_pivot(r_mas, r_slot);
unsigned long range_min = l_mas->min;
l_mas->index = range_min;
if ((l_mas->index == range_min) &&
- l_slot && !mas_get_rcu_slot(l_mas, l_slot - 1)) {
+ l_slot && !mas_get_slot(l_mas, l_slot - 1)) {
if (l_slot > 1)
l_mas->index = mas_safe_pivot(l_mas, l_slot - 2) + 1;
else
mas_set_offset(l_mas, l_slot - 1);
}
- if (!mas_get_rcu_slot(r_mas, r_slot)) {
+ if (!mas_get_slot(r_mas, r_slot)) {
if (r_mas->last < range_max)
r_mas->last = range_max;
cp_r_slot++;
}
if (r_mas->last == range_max &&
- r_mas->last < r_mas->max && !mas_get_rcu_slot(r_mas, r_slot + 1)) {
+ r_mas->last < r_mas->max && !mas_get_slot(r_mas, r_slot + 1)) {
r_mas->last = mas_safe_pivot(r_mas, r_slot + 1);
cp_r_slot++;
}
if (ma_is_leaf(type)) // Leaf.
return true;
- next = mas_get_rcu_slot(mas, mas_offset(mas));
+ next = mas_get_slot(mas, mas_offset(mas));
- if (unlikely(mt_is_empty(next)))
+ if (unlikely(!next))
return false;
// Traverse.
/* Calculate needed space */
slot = mas_offset(mas);
slot_cnt = mt_slot_count(mas->node);
- content = mas_get_rcu_slot(mas, slot);
+ content = mas_get_slot(mas, slot);
if (!overwrite && ((mas->last > r_max) || content)) {
mas_set_err(mas, -EEXIST);
goto exists;
if (mas_can_append(mas, &b_node, slot_cnt, end)) {
slot = b_node.b_end;
do {
- mte_set_rcu_slot(mas->node, slot, b_node.slot[slot]);
+ mte_set_slot(mas->node, slot, b_node.slot[slot]);
if (slot < slot_cnt - 1)
mte_set_pivot(mas->node, slot, b_node.pivot[slot]);
} while(slot && slot-- >= end);
if (slot != 0 && pivot == 0)
break;
- mn = mas_get_rcu_slot(mas, slot);
- if (mt_is_empty(mn))
+ mn = mas_get_slot(mas, slot);
+ if (!mn)
continue;
if (level == 1) {
if (slot != 0 && pivot == 0)
break;
- mn = mas_get_rcu_slot(mas, slot);
- if (mt_is_empty(mn)) {
+ mn = mas_get_slot(mas, slot);
+ if (!mn) {
prev_piv = pivot;
continue;
}
if (pivot < limit)
return false;
- entry = mas_get_rcu_slot(mas, slot);
- if (!mt_is_empty(entry))
+ entry = mas_get_slot(mas, slot);
+ if (entry)
break;
} while (slot--);
if (r_start > mas->max)
goto no_entry;
- entry = mas_get_rcu_slot(mas, slot);
- if (!mt_is_empty(entry))
+ entry = mas_get_slot(mas, slot);
+ if (entry)
goto found;
/* Ran over the limit, this is was the last slot to try */
while (range_start < limit) {
mas_set_offset(mas, slot);
if (!mas_next_nentry(mas, limit, &range_start)) {
- entry = mas_get_rcu_slot(mas, slot - 1);
+ entry = mas_get_slot(mas, slot - 1);
if (mte_is_leaf(mas->node)) {
mas->index = range_start - 1;
mas->index = mte_get_pivot(mas->node, slot - 1);
if (mas_is_none(mas))
return NULL;
- entry = mas_get_rcu_slot(mas, mas_offset(mas));
+ entry = mas_get_slot(mas, mas_offset(mas));
if (mas_dead_node(mas, index))
goto retry;
mas->last = max;
slot = mas_offset(mas);
mas->index = mas_safe_min(mas, slot);
- return mas_get_rcu_slot(mas, mas_offset(mas));
+ return mas_get_slot(mas, mas_offset(mas));
}
/*
}
if (ma_is_leaf(type)) {
- if (mas_get_rcu_slot(mas, slot))
+ if (mas_get_slot(mas, slot))
goto next_slot;
gap = max - min + 1;
if (!ma_is_leaf(type)) { //descend
struct maple_enode *next;
- next = mas_get_rcu_slot(mas, slot);
+ next = mas_get_slot(mas, slot);
mas->min = min;
mas->max = max;
- if (mt_is_empty(next))
+ if (!next)
goto ascend;
mas->node = next;
if (ma_is_leaf(type)) {
gap = 0;
- if (mt_is_empty(mas_get_rcu_slot(mas, slot)))
+ if (!mas_get_slot(mas, slot))
gap = min(pivot, mas->last) -
max(mas->index, min) + 1;
} else {
found = true;
break;
} else if (mas->index <= pivot) {
- mas->node = mas_get_rcu_slot(mas, slot);
+ mas->node = mas_get_slot(mas, slot);
mas->min = min;
mas->max = pivot;
slot = 0;
if (slot >= MAPLE_NODE_SLOTS)
return NULL;
- entry = mas_get_rcu_slot(mas, slot);
+ entry = mas_get_slot(mas, slot);
if (mte_dead_node(mas->node))
goto retry;
}
while (mas_search_cont(mas, index, max, entry)) {
entry = _mas_next(mas, max, &index);
- if (mt_is_empty(entry))
+ if (!entry)
entry = NULL;
}
leaf = _mas_range_walk(&mas, &range_start, &range_end);
slot = mas_offset(&mas);
if (leaf == true && slot != MAPLE_NODE_SLOTS)
- entry = mas_get_rcu_slot(&mas, slot);
+ entry = mas_get_slot(&mas, slot);
mas.last = range_end;
- if (mt_is_empty(entry) || xa_is_zero(entry))
+ if (!entry || xa_is_zero(entry))
entry = NULL;
while (mas_search_cont(&mas, range_start, max, entry)) {
entry = _mas_next(&mas, max, &range_start);
- if (mt_is_empty(entry) || xa_is_zero(entry))
+ if (!entry || xa_is_zero(entry))
entry = NULL;
}
}
prev = mas->node;
- mas->node = mas_get_rcu_slot(mas, slot);
+ mas->node = mas_get_slot(mas, slot);
if (!mas->node) {
if (mte_is_root(prev))
goto done;
for(slot = 0; slot < end; slot++) {
- oldchild = mas_get_rcu_slot(mas, slot);
+ oldchild = mas_get_slot(mas, slot);
if (!oldchild)
return;
child = mas_next_alloc(mas);
echild = mt_mk_node(child, mte_node_type(oldchild));
- mte_set_rcu_slot(mas->node, slot, echild);
+ mte_set_slot(mas->node, slot, echild);
memcpy(child, mte_to_node(oldchild), sizeof(struct maple_node));
}
}
unsigned char p_slot;
int i;
- if (mte_is_dense(mte)) {
+ if (ma_is_dense(mte_node_type(mte))) {
for (i = 0; i < mt_slot_count(mte); i++) {
- if (!mt_is_empty(mas_get_rcu_slot(mas, i))) {
+ if (mas_get_slot(mas, i)) {
if (gap > max_gap)
max_gap = gap;
gap = 0;
p_end = mas->max;
if (mte_is_leaf(mte)) {
- if (!mt_is_empty(mas_get_rcu_slot(mas, i))) {
+ if (mas_get_slot(mas, i)) {
gap = 0;
goto not_empty;
}
gap += p_end - p_start + 1;
} else {
- void *entry = mas_get_rcu_slot(mas, i);
+ void *entry = mas_get_slot(mas, i);
gap = mte_get_gap(mte, i);
- if (mt_is_empty(entry)) {
+ if (!entry) {
if (gap != p_end - p_start + 1) {
pr_err(MA_PTR"[%u] -> "MA_PTR" %lu != %lu - %lu + 1\n",
mas_mn(mas), i,
- mas_get_rcu_slot(mas, i), gap,
+ mas_get_slot(mas, i), gap,
p_end, p_start);
mt_dump(mas->tree);
// Check prev/next parent slot for duplicate node entry
for (i = 0; i < mt_slots[p_type]; i++) {
- node = ma_get_rcu_slot(parent, i, p_type, mas->tree);
+ node = ma_get_slot(parent, i, p_type, mas->tree);
if (i == p_slot) {
if (node != mas->node)
pr_err("parent %p[%u] does not have %p\n",
return;
for (i = 0; i < mt_slots[type]; i++) {
- child = mte_get_rcu_slot(mas->node, i, mas->tree);
+ child = mte_get_slot(mas->node, i, mas->tree);
if (!child)
break;