[30/34] maple_tree: Fix comments for mas_next_entry() and mas_prev_entry()

Message ID 20230425140955.3834476-31-Liam.Howlett@oracle.com
State New
Headers
Series Maple tree mas_{next,prev}_range() and cleanup |

Commit Message

Liam R. Howlett April 25, 2023, 2:09 p.m. UTC
  Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
---
 lib/maple_tree.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)
  

Patch

diff --git a/lib/maple_tree.c b/lib/maple_tree.c
index 297d936321347..377b57bbe6b9b 100644
--- a/lib/maple_tree.c
+++ b/lib/maple_tree.c
@@ -4814,7 +4814,7 @@  void *mas_next_slot(struct ma_state *mas, unsigned long max)
  *
  * 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 limit if it is hit.
+ * Sets @mas->index and @mas->last to the limit if it is within the limit.
  * Restarts on dead nodes.
  *
  * Return: the next entry or %NULL.
@@ -4836,21 +4836,33 @@  static inline void *mas_next_entry(struct ma_state *mas, unsigned long limit)
 	return mas_next_slot(mas, limit);
 }
 
-static inline void *mas_prev_entry(struct ma_state *mas, unsigned long min)
+/*
+ * mas_prev_entry() - Internal function to get the previous entry.
+ * @mas: The maple state
+ * @limit: The minimum range start.
+ *
+ * Set the @mas->node to the previous 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 limit if it is within the limit.
+ * Restarts on dead nodes.
+ *
+ * Return: the next entry or %NULL.
+ */
+static inline void *mas_prev_entry(struct ma_state *mas, unsigned long limit)
 {
 	void *entry;
 
-	if (mas->index < min)
+	if (mas->index < limit)
 		return NULL;
 
-	entry = mas_prev_slot(mas, min);
+	entry = mas_prev_slot(mas, limit);
 	if (entry)
 		return entry;
 
 	if (mas_is_none(mas))
 		return NULL;
 
-	return mas_prev_slot(mas, min);
+	return mas_prev_slot(mas, limit);
 }
 
 /*