X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=radix-tree.c;h=f259ab563b0e9362acbc5d7a438b49094e8341bc;hb=ae60006cee1c15f87adee22d4595384ea5ab596b;hp=baa25ca1c2acb7e05c7fc30b8d163e6ae063894e;hpb=215ad20a9b077d44ea1cf58b1bac64a7f42d058a;p=platform%2Fupstream%2Fbtrfs-progs.git diff --git a/radix-tree.c b/radix-tree.c index baa25ca..f259ab5 100644 --- a/radix-tree.c +++ b/radix-tree.c @@ -1,4 +1,22 @@ /* + * 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 @@ -55,12 +73,7 @@ struct radix_tree_preload { 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; /* @@ -296,7 +309,7 @@ static inline void **__lookup_slot(struct radix_tree_root *root, 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; @@ -815,10 +828,10 @@ int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag) 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; }