On Mon, 27 Aug 2007, Christoph Hellwig wrote:

> The conceptual change looks fine to me, but the code looks a little odd,
> what about:
> 
> static __init unsigned long __maxindex(unsigned int height)
> {
>       unsigned int tmp = height * RADIX_TREE_MAP_SHIFT;
>       int shift = RADIX_TREE_INDEX_BITS - tmp;
> 
>       if (shift < 0)
>               return ~0UL;
>       return ~0UL >> shift;
> }
> 
> instead?

 This patch has been successfully tested on actual hardware (VAXstation 
4000/90).  If nobody objects, I'll push it to Andrew.

  Maciej

Signed-off-by: Maciej W. Rozycki <[EMAIL PROTECTED]>

patch-vax-2.6.17-rc4-20070111-radix-maxindex-0
diff -up --recursive --new-file 
linux-vax-2.6.17-rc4-20070111.macro/lib/radix-tree.c 
linux-vax-2.6.17-rc4-20070111/lib/radix-tree.c
--- linux-vax-2.6.17-rc4-20070111.macro/lib/radix-tree.c        2006-10-31 
19:05:50.000000000 +0000
+++ linux-vax-2.6.17-rc4-20070111/lib/radix-tree.c      2007-01-22 
01:24:17.000000000 +0000
@@ -825,9 +825,11 @@ radix_tree_node_ctor(void *node, kmem_ca
 static __init unsigned long __maxindex(unsigned int height)
 {
        unsigned int tmp = height * RADIX_TREE_MAP_SHIFT;
-       unsigned long index = (~0UL >> (RADIX_TREE_INDEX_BITS - tmp - 1)) >> 1;
+       unsigned long index;
 
-       if (tmp >= RADIX_TREE_INDEX_BITS)
+       if (tmp < RADIX_TREE_INDEX_BITS)
+               index = (~0UL >> (RADIX_TREE_INDEX_BITS - tmp - 1)) >> 1;
+       else
                index = ~0UL;
        return index;
 }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to