aboutsummaryrefslogtreecommitdiff
path: root/fs/btrfs/bit-radix.c
diff options
context:
space:
mode:
authorChris Mason <chris.mason@oracle.com>2007-04-02 10:50:19 -0400
committerDavid Woodhouse <dwmw2@hera.kernel.org>2007-04-02 10:50:19 -0400
commit2c90e5d658424bc71b111eb5a972240d5d06fe86 (patch)
treef46b830654af0f67ef1691353fe4d79943a05465 /fs/btrfs/bit-radix.c
parentd6025579531b7ea170ba283b171ff7a6bf7d0e12 (diff)
Btrfs: still corruption hunting
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/bit-radix.c')
-rw-r--r--fs/btrfs/bit-radix.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/btrfs/bit-radix.c b/fs/btrfs/bit-radix.c
index 845422368f4..a50a1c44eab 100644
--- a/fs/btrfs/bit-radix.c
+++ b/fs/btrfs/bit-radix.c
@@ -4,6 +4,7 @@
#define BIT_ARRAY_BYTES 256
#define BIT_RADIX_BITS_PER_ARRAY ((BIT_ARRAY_BYTES - sizeof(unsigned long)) * 8)
+extern struct kmem_cache *btrfs_bit_radix_cachep;
int set_radix_bit(struct radix_tree_root *radix, unsigned long bit)
{
unsigned long *bits;
@@ -16,7 +17,7 @@ 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_NOFS);
+ bits = kmem_cache_alloc(btrfs_bit_radix_cachep, GFP_NOFS);
if (!bits)
return -ENOMEM;
memset(bits + 1, 0, BIT_ARRAY_BYTES - sizeof(unsigned long));
@@ -68,12 +69,10 @@ int clear_radix_bit(struct radix_tree_root *radix, unsigned long bit)
break;
}
}
-
if (empty) {
bits = radix_tree_delete(radix, slot);
- synchronize_rcu();
BUG_ON(!bits);
- kfree(bits);
+ kmem_cache_free(btrfs_bit_radix_cachep, bits);
}
#endif
return 0;