Commit c2aa6f53 authored by Peng Zhang's avatar Peng Zhang Committed by Andrew Morton

maple_tree: drop mas_{rev_}alloc() and mas_fill_gap()

mas_{rev_}alloc() and mas_fill_gap() are no longer used, delete them.

Link: https://lkml.kernel.org/r/20230524031247.65949-3-zhangpeng.00@bytedance.comSigned-off-by: default avatarPeng Zhang <zhangpeng.00@bytedance.com>
Reviewed-by: default avatarLiam R. Howlett <Liam.Howlett@oracle.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 52371677
...@@ -5120,46 +5120,6 @@ static inline void mas_awalk(struct ma_state *mas, unsigned long size) ...@@ -5120,46 +5120,6 @@ static inline void mas_awalk(struct ma_state *mas, unsigned long size)
} }
} }
/*
* mas_fill_gap() - Fill a located gap with @entry.
* @mas: The maple state
* @entry: The value to store
* @slot: The offset into the node to store the @entry
* @size: The size of the entry
* @index: The start location
*/
static inline void mas_fill_gap(struct ma_state *mas, void *entry,
unsigned char slot, unsigned long size, unsigned long *index)
{
MA_WR_STATE(wr_mas, mas, entry);
unsigned char pslot = mte_parent_slot(mas->node);
struct maple_enode *mn = mas->node;
unsigned long *pivots;
enum maple_type ptype;
/*
* mas->index is the start address for the search
* which may no longer be needed.
* mas->last is the end address for the search
*/
*index = mas->index;
mas->last = mas->index + size - 1;
/*
* It is possible that using mas->max and mas->min to correctly
* calculate the index and last will cause an issue in the gap
* calculation, so fix the ma_state here
*/
mas_ascend(mas);
ptype = mte_node_type(mas->node);
pivots = ma_pivots(mas_mn(mas), ptype);
mas->max = mas_safe_pivot(mas, pivots, pslot, ptype);
mas->min = mas_safe_min(mas, pivots, pslot);
mas->node = mn;
mas->offset = slot;
mas_wr_store_entry(&wr_mas);
}
/* /*
* mas_sparse_area() - Internal function. Return upper or lower limit when * mas_sparse_area() - Internal function. Return upper or lower limit when
* searching for a gap in an empty tree. * searching for a gap in an empty tree.
...@@ -5307,74 +5267,6 @@ int mas_empty_area_rev(struct ma_state *mas, unsigned long min, ...@@ -5307,74 +5267,6 @@ int mas_empty_area_rev(struct ma_state *mas, unsigned long min,
} }
EXPORT_SYMBOL_GPL(mas_empty_area_rev); EXPORT_SYMBOL_GPL(mas_empty_area_rev);
static inline int mas_alloc(struct ma_state *mas, void *entry,
unsigned long size, unsigned long *index)
{
unsigned long min;
mas_start(mas);
if (mas_is_none(mas) || mas_is_ptr(mas)) {
mas_root_expand(mas, entry);
if (mas_is_err(mas))
return xa_err(mas->node);
if (!mas->index)
return mas_pivot(mas, 0);
return mas_pivot(mas, 1);
}
/* Must be walking a tree. */
mas_awalk(mas, size);
if (mas_is_err(mas))
return xa_err(mas->node);
if (mas->offset == MAPLE_NODE_SLOTS)
goto no_gap;
/*
* At this point, mas->node points to the right node and we have an
* offset that has a sufficient gap.
*/
min = mas->min;
if (mas->offset)
min = mas_pivot(mas, mas->offset - 1) + 1;
if (mas_is_err(mas))
return xa_err(mas->node);
if (mas->index < min)
mas->index = min;
mas_fill_gap(mas, entry, mas->offset, size, index);
return 0;
no_gap:
return -EBUSY;
}
static inline int mas_rev_alloc(struct ma_state *mas, unsigned long min,
unsigned long max, void *entry,
unsigned long size, unsigned long *index)
{
int ret = 0;
ret = mas_empty_area_rev(mas, min, max, size);
if (ret)
return ret;
if (mas_is_err(mas))
return xa_err(mas->node);
if (mas->offset == MAPLE_NODE_SLOTS)
goto no_gap;
mas_fill_gap(mas, entry, mas->offset, size, index);
return 0;
no_gap:
return -EBUSY;
}
/* /*
* mte_dead_leaves() - Mark all leaves of a node as dead. * mte_dead_leaves() - Mark all leaves of a node as dead.
* @mas: The maple state * @mas: The maple state
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment