maple_tree: use mas_next_slot() directly
authorWei Yang <richard.weiyang@gmail.com>
Mon, 25 Nov 2024 02:41:56 +0000 (02:41 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 14 Jan 2025 06:40:30 +0000 (22:40 -0800)
The loop condition makes sure (mas.last < max), so we can directly use
mas_next_slot() here.

Since no other use of mas_next_entry(), it is removed.

Link: https://lkml.kernel.org/r/20241125024156.26093-1-richard.weiyang@gmail.com
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Reviewed-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/maple_tree.c

index 047397136f15bfe9421f066e30c05ac6b42b7f6a..36e603645a3069aa9949b7f6a05289c0a6f8f87d 100644 (file)
@@ -4745,29 +4745,6 @@ again:
        return entry;
 }
 
-/*
- * mas_next_entry() - Internal function to get the next entry.
- * @mas: The maple state
- * @limit: The maximum range start.
- *
- * Set the @mas->node to the next entry and the range_start to
- * the beginning value for the entry.  Does not check beyond @limit.
- * Sets @mas->index and @mas->last to the range, Does not update @mas->index and
- * @mas->last on overflow.
- * Restarts on dead nodes.
- *
- * Return: the next entry or %NULL.
- */
-static inline void *mas_next_entry(struct ma_state *mas, unsigned long limit)
-{
-       if (mas->last >= limit) {
-               mas->status = ma_overflow;
-               return NULL;
-       }
-
-       return mas_next_slot(mas, limit, false);
-}
-
 /*
  * mas_rev_awalk() - Internal function.  Reverse allocation walk.  Find the
  * highest gap address of a given size in a given node and descend.
@@ -6938,7 +6915,7 @@ retry:
                goto unlock;
 
        while (mas_is_active(&mas) && (mas.last < max)) {
-               entry = mas_next_entry(&mas, max);
+               entry = mas_next_slot(&mas, max, false);
                if (likely(entry && !xa_is_zero(entry)))
                        break;
        }