Skip to content

Commit

Permalink
Btrfs: corruption hunt continues
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Chris Mason authored and David Woodhouse committed Mar 30, 2007
1 parent 22b0ebd commit d602557
Show file tree
Hide file tree
Showing 11 changed files with 187 additions and 105 deletions.
9 changes: 7 additions & 2 deletions fs/btrfs/bit-radix.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ int set_radix_bit(struct radix_tree_root *radix, unsigned long bit)

bits = radix_tree_lookup(radix, slot);
if (!bits) {
bits = kmalloc(BIT_ARRAY_BYTES, GFP_NOIO);
bits = kmalloc(BIT_ARRAY_BYTES, GFP_NOFS);
if (!bits)
return -ENOMEM;
memset(bits + 1, 0, BIT_ARRAY_BYTES - sizeof(unsigned long));
bits[0] = slot;
radix_tree_preload(GFP_NOFS);
ret = radix_tree_insert(radix, slot, bits);
radix_tree_preload_end();
if (ret)
return ret;
}
Expand Down Expand Up @@ -59,7 +61,7 @@ int clear_radix_bit(struct radix_tree_root *radix, unsigned long bit)
if (!bits)
return 0;
clear_bit(bit_slot, bits + 1);

#if 0
for (i = 1; i < BIT_ARRAY_BYTES / sizeof(unsigned long); i++) {
if (bits[i]) {
empty = 0;
Expand All @@ -69,8 +71,11 @@ int clear_radix_bit(struct radix_tree_root *radix, unsigned long bit)

if (empty) {
bits = radix_tree_delete(radix, slot);
synchronize_rcu();
BUG_ON(!bits);
kfree(bits);
}
#endif
return 0;
}

Expand Down
Loading

0 comments on commit d602557

Please sign in to comment.