#define RADIX_DAX_ENTRY(sector, pmd) ((void *)((unsigned long)sector << \
RADIX_DAX_SHIFT | (pmd ? RADIX_DAX_PMD : RADIX_DAX_PTE)))
-static inline int radix_tree_is_indirect_ptr(void *ptr)
+static inline int radix_tree_is_internal_node(void *ptr)
{
return (int)((unsigned long)ptr & RADIX_TREE_INTERNAL_NODE);
}
*/
static inline int radix_tree_deref_retry(void *arg)
{
- return unlikely(radix_tree_is_indirect_ptr(arg));
+ return unlikely(radix_tree_is_internal_node(arg));
}
/**
*/
static inline void radix_tree_replace_slot(void **pslot, void *item)
{
- BUG_ON(radix_tree_is_indirect_ptr(item));
+ BUG_ON(radix_tree_is_internal_node(item));
rcu_assign_pointer(*pslot, item);
}
if (unlikely(!iter->tags))
return NULL;
while (IS_ENABLED(CONFIG_RADIX_TREE_MULTIORDER) &&
- radix_tree_is_indirect_ptr(slot[1])) {
+ radix_tree_is_internal_node(slot[1])) {
if (entry_to_node(slot[1]) == canon) {
iter->tags >>= 1;
iter->index = __radix_tree_iter_add(iter, 1);
iter->index = __radix_tree_iter_add(iter, 1);
if (IS_ENABLED(CONFIG_RADIX_TREE_MULTIORDER) &&
- radix_tree_is_indirect_ptr(*slot)) {
+ radix_tree_is_internal_node(*slot)) {
if (entry_to_node(*slot) == canon)
continue;
iter->next_index = iter->index;
void **entry = rcu_dereference_raw(parent->slots[offset]);
#ifdef CONFIG_RADIX_TREE_MULTIORDER
- if (radix_tree_is_indirect_ptr(entry)) {
+ if (radix_tree_is_internal_node(entry)) {
unsigned long siboff = get_slot_offset(parent, entry);
if (siboff < RADIX_TREE_MAP_SIZE) {
offset = siboff;
entry, i,
*(void **)entry_to_node(entry),
first, last);
- } else if (!radix_tree_is_indirect_ptr(entry)) {
+ } else if (!radix_tree_is_internal_node(entry)) {
pr_debug("radix entry %p offset %ld indices %ld-%ld\n",
entry, i, first, last);
} else {
pr_debug("radix root: %p rnode %p tags %x\n",
root, root->rnode,
root->gfp_mask >> __GFP_BITS_SHIFT);
- if (!radix_tree_is_indirect_ptr(root->rnode))
+ if (!radix_tree_is_internal_node(root->rnode))
return;
dump_node(entry_to_node(root->rnode), 0);
}
ret = kmem_cache_alloc(radix_tree_node_cachep,
gfp_mask | __GFP_ACCOUNT);
out:
- BUG_ON(radix_tree_is_indirect_ptr(ret));
+ BUG_ON(radix_tree_is_internal_node(ret));
return ret;
}
*nodep = node;
- if (likely(radix_tree_is_indirect_ptr(node))) {
+ if (likely(radix_tree_is_internal_node(node))) {
node = entry_to_node(node);
*maxindex = node_maxindex(node);
return node->shift + RADIX_TREE_MAP_SHIFT;
node->offset = 0;
node->count = 1;
node->parent = NULL;
- if (radix_tree_is_indirect_ptr(slot))
+ if (radix_tree_is_internal_node(slot))
entry_to_node(slot)->parent = node;
node->slots[0] = slot;
slot = node_to_entry(node);
} else
rcu_assign_pointer(root->rnode,
node_to_entry(slot));
- } else if (!radix_tree_is_indirect_ptr(slot))
+ } else if (!radix_tree_is_internal_node(slot))
break;
/* Go a level down */
void **slot;
int error;
- BUG_ON(radix_tree_is_indirect_ptr(item));
+ BUG_ON(radix_tree_is_internal_node(item));
error = __radix_tree_create(root, index, order, &node, &slot);
if (error)
if (index > maxindex)
return NULL;
- while (radix_tree_is_indirect_ptr(node)) {
+ while (radix_tree_is_internal_node(node)) {
unsigned offset;
if (node == RADIX_TREE_RETRY)
shift = radix_tree_load_root(root, &node, &maxindex);
BUG_ON(index > maxindex);
- while (radix_tree_is_indirect_ptr(node)) {
+ while (radix_tree_is_internal_node(node)) {
unsigned offset;
shift -= RADIX_TREE_MAP_SHIFT;
parent = NULL;
- while (radix_tree_is_indirect_ptr(node)) {
+ while (radix_tree_is_internal_node(node)) {
shift -= RADIX_TREE_MAP_SHIFT;
offset = (index >> shift) & RADIX_TREE_MAP_MASK;
if (node == NULL)
return 0;
- while (radix_tree_is_indirect_ptr(node)) {
+ while (radix_tree_is_internal_node(node)) {
int offset;
shift -= RADIX_TREE_MAP_SHIFT;
if (index > maxindex)
return NULL;
- if (radix_tree_is_indirect_ptr(rnode)) {
+ if (radix_tree_is_internal_node(rnode)) {
rnode = entry_to_node(rnode);
} else if (rnode) {
/* Single-slot tree */
if ((slot == NULL) || (slot == RADIX_TREE_RETRY))
goto restart;
- if (!radix_tree_is_indirect_ptr(slot))
+ if (!radix_tree_is_internal_node(slot))
break;
node = entry_to_node(slot);
*first_indexp = last_index + 1;
return 0;
}
- if (!radix_tree_is_indirect_ptr(slot)) {
+ if (!radix_tree_is_internal_node(slot)) {
*first_indexp = last_index + 1;
root_tag_set(root, settag);
return 1;
if (!tag_get(node, iftag, offset))
goto next;
/* Sibling slots never have tags set on them */
- if (radix_tree_is_indirect_ptr(slot)) {
+ if (radix_tree_is_internal_node(slot)) {
node = entry_to_node(slot);
shift -= RADIX_TREE_MAP_SHIFT;
continue;
results[ret] = rcu_dereference_raw(*slot);
if (!results[ret])
continue;
- if (radix_tree_is_indirect_ptr(results[ret])) {
+ if (radix_tree_is_internal_node(results[ret])) {
slot = radix_tree_iter_retry(&iter);
continue;
}
results[ret] = rcu_dereference_raw(*slot);
if (!results[ret])
continue;
- if (radix_tree_is_indirect_ptr(results[ret])) {
+ if (radix_tree_is_internal_node(results[ret])) {
slot = radix_tree_iter_retry(&iter);
continue;
}
rcu_dereference_raw(slot->slots[i]);
if (node == RADIX_TREE_RETRY)
goto out;
- if (!radix_tree_is_indirect_ptr(node)) {
+ if (!radix_tree_is_internal_node(node)) {
if (node == item) {
info->found_index = index;
info->stop = true;
do {
rcu_read_lock();
node = rcu_dereference_raw(root->rnode);
- if (!radix_tree_is_indirect_ptr(node)) {
+ if (!radix_tree_is_internal_node(node)) {
rcu_read_unlock();
if (node == item)
info.found_index = 0;
struct radix_tree_node *to_free = root->rnode;
struct radix_tree_node *slot;
- if (!radix_tree_is_indirect_ptr(to_free))
+ if (!radix_tree_is_internal_node(to_free))
break;
to_free = entry_to_node(to_free);
slot = to_free->slots[0];
if (!slot)
break;
- if (!radix_tree_is_indirect_ptr(slot) && to_free->shift)
+ if (!radix_tree_is_internal_node(slot) && to_free->shift)
break;
- if (radix_tree_is_indirect_ptr(slot))
+ if (radix_tree_is_internal_node(slot))
entry_to_node(slot)->parent = NULL;
/*
* also results in a stale slot). So tag the slot as indirect
* to force callers to retry.
*/
- if (!radix_tree_is_indirect_ptr(slot))
+ if (!radix_tree_is_internal_node(slot))
to_free->slots[0] = RADIX_TREE_RETRY;
radix_tree_node_free(to_free);