]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Make test code work without debug enabled
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Thu, 1 Dec 2022 16:48:12 +0000 (11:48 -0500)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Tue, 13 Dec 2022 21:22:37 +0000 (16:22 -0500)
The test code is less useful without debug, but can still do general
validations.  Define mt_dump() as a noop if debug is not enabled and
document it in the test module information that more information can be
obtained with another kernel config option.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
lib/Kconfig.debug
lib/maple_tree.c
lib/test_maple_tree.c

index 3638b3424be531d3d9593c4703a42aa5355ae6c7..a820b0da01e78e7421cd78242233f5617ef23038 100644 (file)
@@ -2250,8 +2250,13 @@ config TEST_XARRAY
        tristate "Test the XArray code at runtime"
 
 config TEST_MAPLE_TREE
-       select DEBUG_MAPLE_TREE
-       tristate "Test the Maple Tree code at runtime"
+       tristate "Test the Maple Tree code at runtime or module load"
+       help
+         Enable this option to test the maple tree code functions at boot, or
+         when the module is loaded. Enable "Debug Maple Trees" will enable
+         more verbose output on failures.
+
+         If unsure, say N.
 
 config TEST_RHASHTABLE
        tristate "Perform selftest on resizable hash table"
index 766f257a98a447ab4ea69310080c5a073e674199..01c3778dc63ac40c6d8d8370d2ffdd88ed357693 100644 (file)
@@ -6980,6 +6980,7 @@ void mt_dump(const struct maple_tree *mt, enum mt_dump_format format)
                mt_dump_node(mt, entry, 0, mt_max[mte_node_type(entry)], 0,
                             format);
 }
+EXPORT_SYMBOL_GPL(mt_dump);
 
 static void mas_validate_node(struct ma_state *mas,
                              struct maple_enode *leaf_prev)
index 9ef4717dbc6751637d1d145129f430b25ac6a4e6..af2f249684733053684b8a303f8af15665eb65ec 100644 (file)
 #include <linux/module.h>
 
 #define MTREE_ALLOC_MAX 0x2000000000000Ul
-#ifndef CONFIG_DEBUG_MAPLE_TREE
-#define CONFIG_DEBUG_MAPLE_TREE
-#endif
 #define CONFIG_MAPLE_SEARCH
 #define MAPLE_32BIT (MAPLE_NODE_SLOTS > 31)
 
+#ifndef CONFIG_DEBUG_MAPLE_TREE
+#define mt_dump(mt, fmt)               do {} while (0)
+#endif
+
 /* #define BENCH_SLOT_STORE */
 /* #define BENCH_NODE_STORE */
 /* #define BENCH_AWALK */