lkml.org 
[lkml]   [2005]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 02/16] radixtree: sync with mainline
On Mon, Dec 05, 2005 at 09:24:18AM -0800, Christoph Lameter wrote:
> On Mon, 5 Dec 2005, Wu Fengguang wrote:
>
> > return slot;
> >
> > It should be
> >
> > return &slot;
>
> That wont work. slot is a local variable. Drop this patch please.

Thanks. Sorry for the careless mistake.

But your patch do fit well in my patch :)

void *radix_tree_lookup_node(struct radix_tree_root *root,
unsigned long index, unsigned int level)
{
unsigned int height, shift;
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;

while (height > level) {
if (slot == NULL)
return NULL;

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

return slot;
}

void **radix_tree_lookup_slot(struct radix_tree_root *root, unsigned long index)
{
struct radix_tree_node *node;

node = radix_tree_lookup_node(root, index, 1);
return node->slots + (index & RADIX_TREE_MAP_MASK);
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-12-06 03:07    [W:2.065 / U:0.360 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site