/*
+ * Copyright (C) 2007 Oracle. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License v2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 021110-1307, USA.
+ */
+
+/*
* Copyright (C) 2001 Momchil Velikov
* Portions Copyright (C) 2001 Christoph Hellwig
* Copyright (C) 2005 SGI, Christoph Lameter <clameter@sgi.com>
int nr;
struct radix_tree_node *nodes[RADIX_TREE_MAX_PATH];
};
-struct radix_tree_preload radix_tree_preloads = { 0, };
-
-static inline gfp_t root_gfp_mask(struct radix_tree_root *root)
-{
- return root->gfp_mask & __GFP_BITS_MASK;
-}
+static struct radix_tree_preload radix_tree_preloads = { 0, };
static int internal_nodes = 0;
/*
return NULL;
if (height == 0 && root->rnode)
- return (void **)&root->rnode;
+ return (void *)&root->rnode;
shift = (height-1) * RADIX_TREE_MAP_SHIFT;
slot = &root->rnode;
static 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 = ~0UL;
- if (tmp >= RADIX_TREE_INDEX_BITS)
- index = ~0UL;
+ if (tmp < RADIX_TREE_INDEX_BITS)
+ index = (index >> (RADIX_TREE_INDEX_BITS - tmp - 1)) >> 1;
return index;
}