return _mas_add(mas, entry, true, true);
}
-static inline void ma_root_expand(struct ma_state *ms, void *entry)
+static inline void mas_root_expand(struct ma_state *mas, void *entry)
{
- void *r_entry = rcu_dereference(ms->tree->ma_root); // root entry
+ void *r_entry = rcu_dereference(mas->tree->ma_root); // root entry
struct maple_node *mn;
- enum maple_type mt = mas_ptype_leaf(ms);
+ enum maple_type mt = mas_ptype_leaf(mas);
int slot = 0;
- mas_node_cnt(ms, 1);
- if (mas_is_err(ms))
+ mas_node_cnt(mas, 1);
+ if (mas_is_err(mas))
return;
- mn = mas_next_alloc(ms);
- ms->node = mt_mk_node(mn, mt);
+ mn = mas_next_alloc(mas);
+ mas->node = mt_mk_node(mn, mt);
mn->parent = ma_parent_ptr(
- ((unsigned long)ms->tree | MA_ROOT_PARENT));
+ ((unsigned long)mas->tree | MA_ROOT_PARENT));
- if (ms->index != 0) {
+ if (mas->index != 0) {
slot++;
/* Assign the old entry to slot 0, or set it to null. */
- mte_set_rcu_slot(ms->node, 0, r_entry);
+ mte_set_rcu_slot(mas->node, 0, r_entry);
if (!r_entry)
- mte_set_pivot(ms->node, 0, ms->index - 1);
+ mte_set_pivot(mas->node, 0, mas->index - 1);
}
// FIXME: When task_size / page_size -1 works, check to ensure we are
// not inserting above this.
- _mas_insert(ms, entry, slot);
+ _mas_insert(mas, entry, slot);
- if (mas_is_err(ms))
+ if (mas_is_err(mas))
return;
- if (mt_is_alloc(ms->tree)) {
- // FIXME: ms->index = TASK_SIZE / PAGE_SIZE - 1;
- ms->index = 0x2000000000000UL;
- ms->last = mt_max[mt];
- _mas_insert(ms, XA_ZERO_ENTRY, 2);
- if (mas_is_err(ms))
+ if (mt_is_alloc(mas->tree)) {
+ // FIXME: mas->index = TASK_SIZE / PAGE_SIZE - 1;
+ mas->index = 0x2000000000000UL;
+ mas->last = mt_max[mt];
+ _mas_insert(mas, XA_ZERO_ENTRY, 2);
+ if (mas_is_err(mas))
return;
}
/* swap the new root into the tree */
- rcu_assign_pointer(ms->tree->ma_root, mte_mk_root(ms->node));
+ rcu_assign_pointer(mas->tree->ma_root, mte_mk_root(mas->node));
}
static inline int mas_safe_slot(struct ma_state *mas, unsigned char *slot,
goto exists;
if (mas->last != 0)
- ma_root_expand(mas, entry);
+ mas_root_expand(mas, entry);
else if (((unsigned long) (entry) & 3) == 2)
- ma_root_expand(mas, entry);
+ mas_root_expand(mas, entry);
else
rcu_assign_pointer(mas->tree->ma_root, entry);
return 1;
mas_start(mas);
if (mas_is_none(mas) || mas_is_ptr(mas)) {
- ma_root_expand(mas, entry);
+ mas_root_expand(mas, entry);
if (mas_is_err(mas))
return xa_err(mas->node);
}
if (mas_is_ptr(mas)) {
- ma_root_expand(mas, entry);
+ mas_root_expand(mas, entry);
if (!mas->index)
return mte_get_pivot(mas->node, 0);
return mte_get_pivot(mas->node, 1);