lkml.org 
[lkml]   [2005]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 02/16] radixtree: sync with mainline
On Sun, Dec 04, 2005 at 03:57:50PM -0800, Andrew Morton wrote:
> Wu Fengguang <wfg@mail.ustc.edu.cn> wrote:
> >
> > [PATCH] radix-tree: Remove unnecessary indirections and clean up code
> >
> > is only partially merged into -mm tree. This patch completes it.
>
> md: autorun ...
> md: ... autorun DONE.
> Unable to handle kernel paging request at virtual address 8000003c

Sorry, the bug is caused by the returning line:

return slot;

It should be

return &slot;

The patch originally applies to

void *radix_tree_lookup()

But in -mm the function turns into

void **__lookup_slot()

And in my radixtree patch, it is

void *radix_tree_lookup_node()

The prototypes changed forth and back, so the problem was never discovered.

Wu
Subject: radixtree: sync with mainline
Cc: Christoph Lameter <clameter@sgi.com>

The patch from Christoph Lameter:

[PATCH] radix-tree: Remove unnecessary indirections and clean up code

is only partially merged into -mm tree. This patch completes it.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Wu Fengguang <wfg@mail.ustc.edu.cn>
lib/radix-tree.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
--- linux.orig/lib/radix-tree.c
+++ linux/lib/radix-tree.c
@@ -291,27 +291,25 @@ static inline void **__lookup_slot(struc
unsigned long index)
{
unsigned int height, shift;
- struct radix_tree_node **slot;
+ struct radix_tree_node *slot;

height = root->height;
if (index > radix_tree_maxindex(height))
return NULL;

shift = (height-1) * RADIX_TREE_MAP_SHIFT;
- slot = &root->rnode;
+ slot = root->rnode;

while (height > 0) {
- if (*slot == NULL)
+ if (slot == NULL)
return NULL;

- slot = (struct radix_tree_node **)
- ((*slot)->slots +
- ((index >> shift) & RADIX_TREE_MAP_MASK));
+ slot = slot->slots[(index >> shift) & RADIX_TREE_MAP_MASK];
shift -= RADIX_TREE_MAP_SHIFT;
height--;
}

- return (void **)slot;
+ return &slot;
}

/**
\
 
 \ /
  Last update: 2005-12-05 11:36    [from the cache]
©2003-2011 Jasper Spaans