Re: [PATCH 8/9] maple_tree: Remove the redundant check of mas->offset in mas_empty_area/area_rev()

From: Liam R. Howlett
Date: Tue Apr 25 2023 - 13:00:40 EST


* Peng Zhang <zhangpeng.00@xxxxxxxxxxxxx> [230425 07:05]:

The subject doesn't need this much detail. If mas->offset means
something to people reading through the git logs, they will already be
looking into the change.

> In mas_empty_area(), after mas_awalk() returns, if EBUSY is not set,
> then mas->offset must be valid, no need to check. Same in
> mas_empty_area_rev(), so delete it.

There is a lot of code in this message as well.

>
> Signed-off-by: Peng Zhang <zhangpeng.00@xxxxxxxxxxxxx>
> ---
> lib/maple_tree.c | 7 -------
> 1 file changed, 7 deletions(-)
>
> diff --git a/lib/maple_tree.c b/lib/maple_tree.c
> index 8bfa837b7b752..964214de2ed18 100644
> --- a/lib/maple_tree.c
> +++ b/lib/maple_tree.c
> @@ -5305,13 +5305,9 @@ int mas_empty_area(struct ma_state *mas, unsigned long min,
> return xa_err(mas->node);
>
> offset = mas->offset;
> - if (unlikely(offset == MAPLE_NODE_SLOTS))
> - return -EBUSY;
> -
> mt = mte_node_type(mas->node);
> pivots = ma_pivots(mas_mn(mas), mt);
> mas->index = max(mas->index, mas_safe_min(mas, pivots, offset));
> -
> mas->last = mas->index + size - 1;
> return 0;
> }
> @@ -5365,9 +5361,6 @@ int mas_empty_area_rev(struct ma_state *mas, unsigned long min,
> if (mas_is_err(mas))
> return xa_err(mas->node);
>
> - if (unlikely(mas->offset == MAPLE_NODE_SLOTS))
> - return -EBUSY;
> -
> /* Trim the upper limit to the max. */
> if (max < mas->last)
> mas->last = max;
> --
> 2.20.1
>