aboutsummaryrefslogtreecommitdiff
path: root/fs/btrfs/bit-radix.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-03-30 14:27:56 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-03-30 14:27:56 -0400
commitd6025579531b7ea170ba283b171ff7a6bf7d0e12 (patch)
treec3b742fda3a6ac8541c06011bb3c26635db99212 /fs/btrfs/bit-radix.c
parent22b0ebda6c63a1ad66b6a9e806bd226a4a03a049 (diff)
Btrfs: corruption hunt continues
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/bit-radix.c')
-rw-r--r--fs/btrfs/bit-radix.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/btrfs/bit-radix.c b/fs/btrfs/bit-radix.c
index 43807cc3cce..845422368f4 100644
--- a/fs/btrfs/bit-radix.c
+++ b/fs/btrfs/bit-radix.c
@@ -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;
}
@@ -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;
@@ -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;
}