From: Matthew Wilcox <willy@linux.intel.com>
To: linux-kernel@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>,
linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
Konstantin Khlebnikov <koct9i@gmail.com>,
Kirill Shutemov <kirill.shutemov@linux.intel.com>,
Jan Kara <jack@suse.com>, Neil Brown <neilb@suse.de>,
Matthew Wilcox <willy@linux.intel.com>
Subject: [PATCH 29/30] radix-tree: Fix radix_tree_dump() for multi-order entries
Date: Wed, 6 Apr 2016 17:21:38 -0400 [thread overview]
Message-ID: <1459977699-2349-30-git-send-email-willy@linux.intel.com> (raw)
In-Reply-To: <1459977699-2349-1-git-send-email-willy@linux.intel.com>
From: Ross Zwisler <ross.zwisler@linux.intel.com>
- Print which indices are covered by every leaf entry
- Print sibling entries
- Print the node pointer instead of the slot entry
- Build by default in userspace, and make it accessible to the test-suite
Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
---
lib/radix-tree.c | 46 +++++++++++++++++++++++++----------------
tools/testing/radix-tree/test.h | 1 +
2 files changed, 29 insertions(+), 18 deletions(-)
diff --git a/lib/radix-tree.c b/lib/radix-tree.c
index fa7842cb814e..0402c4f1a344 100644
--- a/lib/radix-tree.c
+++ b/lib/radix-tree.c
@@ -215,27 +215,36 @@ radix_tree_find_next_bit(const unsigned long *addr,
return size;
}
-#if 0
-static void dump_node(void *slot, int height, int offset)
+#ifndef __KERNEL__
+static void dump_node(struct radix_tree_node *node, unsigned offset,
+ unsigned shift, unsigned long index)
{
- struct radix_tree_node *node;
int i;
- if (!slot)
- return;
-
- if (height == 0) {
- pr_debug("radix entry %p offset %d\n", slot, offset);
- return;
- }
-
- node = indirect_to_ptr(slot);
pr_debug("radix node: %p offset %d tags %lx %lx %lx path %x count %d parent %p\n",
- slot, offset, node->tags[0][0], node->tags[1][0],
- node->tags[2][0], node->path, node->count, node->parent);
-
- for (i = 0; i < RADIX_TREE_MAP_SIZE; i++)
- dump_node(node->slots[i], height - 1, i);
+ node, offset,
+ node->tags[0][0], node->tags[1][0], node->tags[2][0],
+ node->path, node->count, node->parent);
+
+ for (i = 0; i < RADIX_TREE_MAP_SIZE; i++) {
+ unsigned long first = index | (i << shift);
+ unsigned long last = first | ((1 << shift) - 1);
+ void *entry = node->slots[i];
+ if (!entry)
+ continue;
+ if (is_sibling_entry(node, entry)) {
+ pr_debug("radix sblng %p offset %d val %p indices %ld-%ld\n",
+ entry, i,
+ *(void **)indirect_to_ptr(entry),
+ first, last);
+ } else if (!radix_tree_is_indirect_ptr(entry)) {
+ pr_debug("radix entry %p offset %d indices %ld-%ld\n",
+ entry, offset, first, last);
+ } else {
+ dump_node(indirect_to_ptr(entry), i,
+ shift - RADIX_TREE_MAP_SHIFT, first);
+ }
+ }
}
/* For debug */
@@ -246,7 +255,8 @@ static void radix_tree_dump(struct radix_tree_root *root)
root->gfp_mask >> __GFP_BITS_SHIFT);
if (!radix_tree_is_indirect_ptr(root->rnode))
return;
- dump_node(root->rnode, root->height, 0);
+ dump_node(indirect_to_ptr(root->rnode), 0,
+ (root->height - 1) * RADIX_TREE_MAP_SHIFT, 0);
}
#endif
diff --git a/tools/testing/radix-tree/test.h b/tools/testing/radix-tree/test.h
index 53cb595db44a..67217c93fe95 100644
--- a/tools/testing/radix-tree/test.h
+++ b/tools/testing/radix-tree/test.h
@@ -40,5 +40,6 @@ extern int nr_allocated;
/* Normally private parts of lib/radix-tree.c */
void *indirect_to_ptr(void *ptr);
+void radix_tree_dump(struct radix_tree_root *root);
int root_tag_get(struct radix_tree_root *root, unsigned int tag);
unsigned long radix_tree_maxindex(unsigned int height);
--
2.8.0.rc3
next prev parent reply other threads:[~2016-04-06 21:21 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-06 21:21 [PATCH 00/30] Radix tree multiorder fixes Matthew Wilcox
2016-04-06 21:21 ` [PATCH 01/30] radix-tree: Introduce radix_tree_empty Matthew Wilcox
2016-04-06 21:21 ` [PATCH 02/30] radix tree test suite: Fix build Matthew Wilcox
2016-04-06 21:21 ` [PATCH 03/30] radix tree test suite: Add tests for radix_tree_locate_item() Matthew Wilcox
2016-04-06 21:21 ` [PATCH 04/30] radix tree test suite: Allow testing other fan-out values Matthew Wilcox
2016-04-06 21:21 ` [PATCH 05/30] radix tree test suite: keep regression test runs short Matthew Wilcox
2016-04-06 21:21 ` [PATCH 06/30] radix tree test suite: rebuild when headers change Matthew Wilcox
2016-04-06 21:21 ` [PATCH 07/30] radix-tree: remove unused looping macros Matthew Wilcox
2016-04-06 21:21 ` [PATCH 08/30] Introduce CONFIG_RADIX_TREE_MULTIORDER Matthew Wilcox
2016-04-06 21:21 ` [PATCH 09/30] radix-tree: Add missing sibling entry functionality Matthew Wilcox
2016-04-06 21:21 ` [PATCH 10/30] radix-tree: Fix sibling entry insertion Matthew Wilcox
2016-04-06 21:21 ` [PATCH 11/30] radix-tree: Fix deleting a multi-order entry through an alias Matthew Wilcox
2016-04-06 21:21 ` [PATCH 12/30] radix-tree: Remove restriction on multi-order entries Matthew Wilcox
2016-04-06 21:21 ` [PATCH 13/30] radix-tree: Introduce radix_tree_load_root() Matthew Wilcox
2016-04-06 21:21 ` [PATCH 14/30] radix-tree: Fix extending the tree for multi-order entries at offset 0 Matthew Wilcox
2016-04-06 21:21 ` [PATCH 15/30] radix-tree: Fix several shrinking bugs with multiorder entries Matthew Wilcox
2016-04-06 21:21 ` [PATCH 16/30] radix tree test suite: Start adding multiorder tests Matthew Wilcox
2016-04-06 21:21 ` [PATCH 17/30] radix-tree: Rewrite __radix_tree_lookup Matthew Wilcox
2016-04-06 21:21 ` [PATCH 18/30] radix-tree: Fix multiorder BUG_ON in radix_tree_insert Matthew Wilcox
2016-04-06 21:21 ` [PATCH 19/30] radix-tree: add support for multi-order iterating Matthew Wilcox
2016-04-06 21:21 ` [PATCH 20/30] radix tree test suite: multi-order iteration test Matthew Wilcox
2016-04-06 21:21 ` [PATCH 21/30] radix tree test suite: Add multiorder shrinking test Matthew Wilcox
2016-04-06 21:21 ` [PATCH 22/30] radix-tree: Rewrite radix_tree_tag_set Matthew Wilcox
2016-04-06 21:21 ` [PATCH 23/30] radix-tree: Rewrite radix_tree_tag_clear Matthew Wilcox
2016-04-06 21:21 ` [PATCH 24/30] radix-tree: Rewrite radix_tree_tag_get Matthew Wilcox
2016-04-06 21:21 ` [PATCH 25/30] radix-tree test suite: add multi-order tag test Matthew Wilcox
2016-04-06 21:21 ` [PATCH 26/30] radix-tree: Fix radix_tree_create for sibling entries Matthew Wilcox
2016-04-06 21:21 ` [PATCH 27/30] radix-tree: Rewrite radix_tree_locate_item Matthew Wilcox
2016-04-06 21:21 ` [PATCH 28/30] radix-tree: Fix two bugs in radix_tree_range_tag_if_tagged() Matthew Wilcox
2016-04-06 21:21 ` Matthew Wilcox [this message]
2016-04-06 21:21 ` [PATCH 30/30] radix-tree: Add copyright statements Matthew Wilcox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1459977699-2349-30-git-send-email-willy@linux.intel.com \
--to=willy@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=jack@suse.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=koct9i@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=neilb@suse.de \
--cc=ross.zwisler@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).