aboutsummaryrefslogtreecommitdiffstats
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 845422368f48..a50a1c44eabd 100644
--- a/fs/btrfs/bit-radix.c
+++ b/fs/btrfs/bit-radix.c
@@ -4,6 +4,7 @@
4#define BIT_ARRAY_BYTES 256 4#define BIT_ARRAY_BYTES 256
5#define BIT_RADIX_BITS_PER_ARRAY ((BIT_ARRAY_BYTES - sizeof(unsigned long)) * 8) 5#define BIT_RADIX_BITS_PER_ARRAY ((BIT_ARRAY_BYTES - sizeof(unsigned long)) * 8)
6 6
7extern struct kmem_cache *btrfs_bit_radix_cachep;
7int set_radix_bit(struct radix_tree_root *radix, unsigned long bit) 8int set_radix_bit(struct radix_tree_root *radix, unsigned long bit)
8{ 9{
9 unsigned long *bits; 10 unsigned long *bits;
@@ -16,7 +17,7 @@ int set_radix_bit(struct radix_tree_root *radix, unsigned long bit)
16 17
17 bits = radix_tree_lookup(radix, slot); 18 bits = radix_tree_lookup(radix, slot);
18 if (!bits) { 19 if (!bits) {
19 bits = kmalloc(BIT_ARRAY_BYTES, GFP_NOFS); 20 bits = kmem_cache_alloc(btrfs_bit_radix_cachep, GFP_NOFS);
20 if (!bits) 21 if (!bits)
21 return -ENOMEM; 22 return -ENOMEM;
22 memset(bits + 1, 0, BIT_ARRAY_BYTES - sizeof(unsigned long)); 23 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)
68 break; 69 break;
69 } 70 }
70 } 71 }
71
72 if (empty) { 72 if (empty) {
73 bits = radix_tree_delete(radix, slot); 73 bits = radix_tree_delete(radix, slot);
74 synchronize_rcu();
75 BUG_ON(!bits); 74 BUG_ON(!bits);
76 kfree(bits); 75 kmem_cache_free(btrfs_bit_radix_cachep, bits);
77 } 76 }
78#endif 77#endif
79 return 0; 78 return 0;