From: Liam R. Howlett Date: Thu, 1 Dec 2022 16:48:12 +0000 (-0500) Subject: maple_tree: Make test code work without debug enabled X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=422c8b25c585509762b3e186340a87ceea4bdd1f;p=users%2Fjedix%2Flinux-maple.git maple_tree: Make test code work without debug enabled 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 --- diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 3638b3424be5..a820b0da01e7 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -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" diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 766f257a98a4..01c3778dc63a 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -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) diff --git a/lib/test_maple_tree.c b/lib/test_maple_tree.c index 9ef4717dbc67..af2f24968473 100644 --- a/lib/test_maple_tree.c +++ b/lib/test_maple_tree.c @@ -11,12 +11,13 @@ #include #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 */