From f9a3664fe0eba16a4f9f0e3ff6b1a6c6ab712186 Mon Sep 17 00:00:00 2001 From: "Liam R. Howlett" Date: Tue, 1 Mar 2022 10:54:44 -0500 Subject: [PATCH] maple tree: debug compile issues Signed-off-by: Liam R. Howlett --- lib/maple_tree.c | 49 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 055697b4df0c..37717fbe6470 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -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). -- 2.50.1