From a819e7faf44329112c4279e54a8378afcaf87aae Mon Sep 17 00:00:00 2001 From: Matthew Wilcox Date: Sat, 8 Dec 2018 08:48:41 -0500 Subject: [PATCH] maple_tree: Fix mt_dump() Dump the raw contents of the node to help with debugging. Fix a bug where mt_dump() wouldn't show the last entry in a node. Signed-off-by: Matthew Wilcox --- lib/maple_tree.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 48da513c5ae5..6d2964e67122 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -818,13 +818,18 @@ void mn_dump(void *entry, unsigned long min, unsigned long max) unsigned long prev = min; unsigned int i; - pr_cont("node %p parent %p\n", mn64, mn64->parent); + pr_cont("node %p parent %p contents: ", mn64, mn64->parent); + for (i = 0; i < MAPLE_NODE64_MAX_PIVOT; i++) { + pr_cont("%p %lu ", mn64->slot[i], mn64->pivot[i]); + } + pr_cont("%p\n", mn64->slot[i]); + for (i = 0; i < MAPLE_NODE64_MAX_SLOT; i++) { unsigned long next = max + 1; if (i < MAPLE_NODE64_MAX_PIVOT) next = mn64->pivot[i]; mn_dump(mn64->slot[i], prev, next - 1); - if (next == 0 || next >= max) + if (next == 0 || (next - 1) >= max) break; prev = next; } -- 2.50.1