]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Fix mt_dump()
authorMatthew Wilcox <willy@infradead.org>
Sat, 8 Dec 2018 13:48:41 +0000 (08:48 -0500)
committerMatthew Wilcox <willy@infradead.org>
Sat, 8 Dec 2018 13:57:54 +0000 (08:57 -0500)
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 <willy@infradead.org>
lib/maple_tree.c

index 48da513c5ae5f94faa1e178c330ae14f17f3db2b..6d2964e671224ee5415293ab8a3e59231e47d063 100644 (file)
@@ -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;
                }