Btrfs: many allocator fixes, pretty solid
Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:
committed by
David Woodhouse
parent
3e1ad54fe2
commit
e37c9e6921
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user