]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple tree: debug compile issues
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 1 Mar 2022 15:54:44 +0000 (10:54 -0500)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 8 Mar 2022 18:19:15 +0000 (13:19 -0500)
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
lib/maple_tree.c

index 055697b4df0c1a3cde35e1b58361f3f199fcf7a4..37717fbe6470a7f50358e8a53edc69ff0da51a87 100644 (file)
@@ -6317,11 +6317,46 @@ unsigned int mt_nr_allocated()
        return kmem_cache_nr_allocated(maple_node_cache);
 }
 
+/*
+ * mas_dead_node() - Check if the maple state is pointing to a dead node.
+ * @mas: The maple state
+ * @index: The index to restore in @mas.
+ *
+ * Used in test code.
+ * Return: 1 if @mas has been reset to MAS_START, 0 otherwise.
+ */
+static inline int mas_dead_node(struct ma_state *mas, unsigned long index)
+{
+       if (unlikely(!mas_searchable(mas) || mas_is_start(mas)))
+               return 0;
+
+       if (likely(!mte_dead_node(mas->node)))
+               return 0;
+
+       mas_rewalk(mas, index);
+       return 1;
+}
+
 #define MA_PTR "%p"
 #else /*  __KERNEL__ is defined */
 #define MA_PTR "%px"
 #endif
 
+/*
+ * mas_get_slot() - Get the entry in the maple state node stored at @offset.
+ * @mas: The maple state
+ * @offset: The offset into the slot array to fetch.
+ *
+ * Return: The entry stored at @offset.
+ */
+static inline struct maple_enode *mas_get_slot(struct ma_state *mas,
+               unsigned char offset)
+{
+       return mas_slot(mas, ma_slots(mas_mn(mas), mte_node_type(mas->node)),
+                      offset);
+}
+
+
 #ifdef CONFIG_MAPLE_SEARCH
 /* mas limits not adjusted */
 static void mas_dfs_preorder(struct ma_state *mas)
@@ -6640,20 +6675,6 @@ void mt_dump(const struct maple_tree *mt)
                mt_dump_node(mt, entry, 0, mt_max[mte_node_type(entry)], 0);
 }
 
-/*
- * mas_get_slot() - Get the entry in the maple state node stored at @offset.
- * @mas: The maple state
- * @offset: The offset into the slot array to fetch.
- *
- * Return: The entry stored at @offset.
- */
-static inline struct maple_enode *mas_get_slot(struct ma_state *mas,
-               unsigned char offset)
-{
-       return mas_slot(mas, ma_slots(mas_mn(mas), mte_node_type(mas->node)),
-                      offset);
-}
-
 /*
  * Calculate the maximum gap in a node and check if that's what is reported in
  * the parent (unless root).