diff options
author | Chris Mason <chris.mason@oracle.com> | 2007-05-09 20:13:14 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@hera.kernel.org> | 2007-05-09 20:13:14 -0400 |
commit | e37c9e6921207cf503634b06bee37ecb7904408d (patch) | |
tree | 6f04d434ce9407b01b1fa36139ae8ffc7957fd1c /fs/btrfs/bit-radix.c | |
parent | 3e1ad54fe2839319c1aa66b954da0753f5b1f906 (diff) | |
download | linux-stable-e37c9e6921207cf503634b06bee37ecb7904408d.tar.gz linux-stable-e37c9e6921207cf503634b06bee37ecb7904408d.tar.bz2 linux-stable-e37c9e6921207cf503634b06bee37ecb7904408d.zip |
Btrfs: many allocator fixes, pretty solid
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/bit-radix.c')
-rw-r--r-- | fs/btrfs/bit-radix.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/btrfs/bit-radix.c b/fs/btrfs/bit-radix.c index 1a0271445dfb..8f9cd4277231 100644 --- a/fs/btrfs/bit-radix.c +++ b/fs/btrfs/bit-radix.c @@ -77,7 +77,7 @@ int clear_radix_bit(struct radix_tree_root *radix, unsigned long bit) } int find_first_radix_bit(struct radix_tree_root *radix, unsigned long *retbits, - int nr) + unsigned long start, int nr) { unsigned long *bits; unsigned long *gang[4]; @@ -85,10 +85,13 @@ int find_first_radix_bit(struct radix_tree_root *radix, unsigned long *retbits, int ret; int i; int total_found = 0; + unsigned long slot; - ret = radix_tree_gang_lookup(radix, (void **)gang, 0, ARRAY_SIZE(gang)); + slot = start / BIT_RADIX_BITS_PER_ARRAY; + ret = radix_tree_gang_lookup(radix, (void **)gang, slot, + ARRAY_SIZE(gang)); + found = start % BIT_RADIX_BITS_PER_ARRAY; for (i = 0; i < ret && nr > 0; i++) { - found = 0; bits = gang[i]; while(nr > 0) { found = find_next_bit(bits + 1, @@ -104,6 +107,7 @@ int find_first_radix_bit(struct radix_tree_root *radix, unsigned long *retbits, } else break; } + found = 0; } return total_found; } |