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) || xa_is_retry(entry)) {
+ if (!mt_is_empty(entry)) {
if (gap > max_gap)
max_gap = gap;
gap = 0;
gap = pend - pstart + 1;
entry = mas_get_rcu_slot(mas, i);
- if (!mt_is_empty(entry) || xa_is_retry(entry))
+ if (!mt_is_empty(entry))
goto next;
if (gap > max_gap)
// walk up.
while (1) {
slot = mte_parent_slot(mas->node);
-walk_again:
if (mte_is_root(mas->node))
goto no_entry;
mas->min = mas_get_safe_pivot(mas, slot - 1) + 1;
mas->max = mas_get_safe_pivot(mas, slot);
entry = mas_get_rcu_slot(mas, slot);
- if (xa_is_skip(entry)) {
- if (mas->max >= max) {
- goto no_entry;
- } else if (slot < mt_slot_count(mas->node)) {
- slot++;
- goto walk_down;
- } else if (mte_is_root(mas->node)) {
- goto no_entry;
- } else {
- goto walk_again;
- }
- }
-
mas->node = entry;
if (mt_is_empty(mas->node))
goto no_entry;
break;
mn = mas_get_rcu_slot(mas, slot);
- if (mt_is_empty(mn) || xa_is_retry(mn))
+ if (mt_is_empty(mn))
continue;
if (level == 1) {
break;
mn = mas_get_rcu_slot(mas, slot);
- if (mt_is_empty(mn) || xa_is_retry(mn)) {
+ if (mt_is_empty(mn)) {
prev_piv = pivot;
continue;
}
/* check if this slot is full */
entry = mas_get_rcu_slot(mas, i);
- if (entry && !xa_is_deleted(entry)) {
+ if (entry) {
this_gap = 0;
goto next_slot;
}
*
*/
void *mas_range_load(struct ma_state *mas, unsigned long *range_min,
- unsigned long *range_max, bool skip_retry)
+ unsigned long *range_max)
{
void *entry = NULL;
if (mas_is_none(mas))
return NULL;
- if (!entry || xa_is_deleted(entry))
+ if (!entry)
return NULL;
- if (skip_retry && xa_is_retry(entry))
- goto retry;
-
return entry;
}
{
unsigned long range_max, range_min;
- return mas_range_load(mas, &range_min, &range_max, true);
+ return mas_range_load(mas, &range_min, &range_max);
}
/** Private
if (!mas->node || mas_is_start(mas)) {// First run.
*range_start = 0;
mas_start(mas);
- entry = mas_range_load(mas, range_start, &range_max, false);
+ entry = mas_range_load(mas, range_start, &range_max);
mas->last = range_max;
}
entry = mas_get_rcu_slot(&mas, slot);
mas.last = range_end;
- if (mt_is_empty(entry) || xa_is_zero(entry) || xa_is_retry(entry))
+ if (mt_is_empty(entry) || xa_is_zero(entry))
entry = NULL;
while (mas_search_cont(&mas, range_start, max, entry)) {
return _mt_find(mt, index, max, true);
}
EXPORT_SYMBOL(mt_find);
+
/*
* mas_next() - Get the next entry. Can return the zero entry. mas->node
* must be a valid node and not a special value. Unsafe for single entry
* trees.
- *
*/
void *mas_next(struct ma_state *mas, unsigned long max)
{
unsigned long r_max, r_min;
void *entry = NULL;
- entry = mas_range_load(mas, &r_min, &r_max, true);
+ entry = mas_range_load(mas, &r_min, &r_max);
retry:
mas->node = MAS_START;
mas->index = r_min;
xa_to_value(entry), entry);
else if (xa_is_zero(entry))
pr_cont("zero (%ld)\n", xa_to_internal(entry));
- else if (xa_is_deleted(entry))
- pr_cont("deleted (%ld)\n", xa_to_internal(entry));
- else if (xa_is_skip(entry))
- pr_cont("skip (%ld)\n", xa_to_internal(entry));
- else if (xa_is_retry(entry))
- pr_cont("retry (%ld)\n", xa_to_internal(entry));
else if (mt_is_reserved(entry))
pr_cont("UNKNOWN ENTRY ("MA_PTR")\n", entry);
else
break;
if (leaf)
mt_dump_entry(node->slot[i], first, last, depth + 1);
- else if (xa_is_deleted(node->slot[i]))
- mt_dump_entry(node->slot[i], first, last, depth + 1);
- else if (xa_is_skip(node->slot[i]))
- mt_dump_entry(node->slot[i], first, last, depth + 1);
- else if (xa_is_retry(node->slot[i]))
- mt_dump_entry(node->slot[i], first, last, depth + 1);
else if (node->slot[i])
mt_dump_node(node->slot[i], first, last, depth + 1);
break;
if (leaf)
mt_dump_entry(node->slot[i], first, last, depth + 1);
- else if (xa_is_deleted(node->slot[i]))
- mt_dump_entry(node->slot[i], first, last, depth + 1);
- else if (xa_is_skip(node->slot[i]))
- mt_dump_entry(node->slot[i], first, last, depth + 1);
- else if (xa_is_retry(node->slot[i]))
- mt_dump_entry(node->slot[i], first, last, depth + 1);
else if (node->slot[i])
mt_dump_node(node->slot[i], first, last, depth + 1);
} else {
void *entry = mas_get_rcu_slot(mas, i);
gap = mte_get_gap(mte, i);
- if (xa_is_skip(entry)) {
- //pr_err("%s: skip entry missed by spanning add?\n");
- } else if (mt_is_empty(entry) || xa_is_retry(entry)) {
+ if (mt_is_empty(entry)) {
if (gap != p_end - p_start + 1) {
- if (xa_is_retry(entry))
- pr_err("retry\n");
-
pr_err(MA_PTR"[%u] -> "MA_PTR" %lu != %lu - %lu + 1\n",
mas_mn(mas), i,
mas_get_rcu_slot(mas, i), gap,