summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMatthew Wilcox <willy@linux.intel.com>2016-03-17 17:21:57 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-03-17 18:09:34 -0400
commit7cf19af4debc804e408b059d58df7c9c226ca6fb (patch)
tree650d5a0be06e519c954f421c8352cdb86fd1a81e /lib
parente61452365372570253b2b1de84bab0cdb2e62c64 (diff)
radix_tree: add radix_tree_dump
This is debug code which is #if 0 out. Signed-off-by: Matthew Wilcox <willy@linux.intel.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Matthew Wilcox <willy@linux.intel.com> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> Cc: Ross Zwisler <ross.zwisler@linux.intel.com> Cc: Hugh Dickins <hughd@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/radix-tree.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index d907dca302d5..1624c4117961 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -173,6 +173,41 @@ radix_tree_find_next_bit(const unsigned long *addr,
173 return size; 173 return size;
174} 174}
175 175
176#if 0
177static void dump_node(void *slot, int height, int offset)
178{
179 struct radix_tree_node *node;
180 int i;
181
182 if (!slot)
183 return;
184
185 if (height == 0) {
186 pr_debug("radix entry %p offset %d\n", slot, offset);
187 return;
188 }
189
190 node = indirect_to_ptr(slot);
191 pr_debug("radix node: %p offset %d tags %lx %lx %lx path %x count %d parent %p\n",
192 slot, offset, node->tags[0][0], node->tags[1][0],
193 node->tags[2][0], node->path, node->count, node->parent);
194
195 for (i = 0; i < RADIX_TREE_MAP_SIZE; i++)
196 dump_node(node->slots[i], height - 1, i);
197}
198
199/* For debug */
200static void radix_tree_dump(struct radix_tree_root *root)
201{
202 pr_debug("radix root: %p height %d rnode %p tags %x\n",
203 root, root->height, root->rnode,
204 root->gfp_mask >> __GFP_BITS_SHIFT);
205 if (!radix_tree_is_indirect_ptr(root->rnode))
206 return;
207 dump_node(root->rnode, root->height, 0);
208}
209#endif
210
176/* 211/*
177 * This assumes that the caller has performed appropriate preallocation, and 212 * This assumes that the caller has performed appropriate preallocation, and
178 * that the caller has pinned this thread of control to the current CPU. 213 * that the caller has pinned this thread of control to the current CPU.