static inline void *mas_root(struct ma_state *mas)
{
if (mt_in_rcu(mas->tree))
- return rcu_dereference(mas->tree->ma_root)
+ return rcu_dereference(mas->tree->ma_root);
return mas->tree->ma_root;
}
mas->max = ULONG_MAX;
mas->depth = 0;
mas_set_offset(mas, 0);
- if (!mas->tree->ma_root) // empty tree.
+ if (!mas_root(mas)) // empty tree.
goto done;
- root = mte_safe_root(mas->tree->ma_root);
+ root = mte_safe_root(mas_root(mas));
- if (xa_is_node(mas->tree->ma_root)) {
+ if (xa_is_node(mas_root(mas))) {
mas->node = root;
} else {
// Single entry tree.
if (mas->index > 0)
goto done;
- entry = mas->tree->ma_root;
+ entry = mas_root(mas);
mas->node = MAS_ROOT;
mas_set_offset(mas, MAPLE_NODE_SLOTS);
}
void **slots;
if (mte_is_root(mas->node)) {
- prev = mas->tree->ma_root;
+ prev = mas_root_locked(mas);
} else {
enum maple_type ptype = mas_parent_enum(mas, mas->node);
{
int ret = 1;
- if (xa_is_node(mas->tree->ma_root))
+ if (xa_is_node(mas_root(mas)))
return 0;
- if (mas->tree->ma_root && mas->last == 0) {
+ if (mas_root(mas) && mas->last == 0) {
contents = mas_root_locked(mas);
if (!overwrite)
goto exists;
do {
entry = slots[offset];
if (!last && !entry) {
- printk("Sequential nulls end at %p[%u]\n",
+ pr_err("Sequential nulls end at %p[%u]\n",
mas_mn(&mas), offset);
}
MT_BUG_ON(mt, !last && !entry);
MA_STATE(mas, mt, 0, 0);
rcu_read_lock();
mas_start(&mas);
+ if (!mas_searchable(&mas))
+ goto done;
+
mas_first_entry(&mas, ULONG_MAX);
while (!mas_is_none(&mas)) {
if (!mte_is_root(mas.node)) {
mas_dfs_postorder(&mas, ULONG_MAX);
}
mt_validate_nulls(mt);
+done:
rcu_read_unlock();
}