diff options
author | Chris Mason <chris.mason@oracle.com> | 2009-02-04 09:24:05 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-02-04 09:24:05 -0500 |
commit | 3935127c50c84106d654ef14962cff28c660bc62 (patch) | |
tree | 1d277f316eb0134a4a76fa2b237a048a0d925911 | |
parent | b7a9f29fcf4e53e9ca7982331649fa2013e69c99 (diff) |
Btrfs: disable leak debugging checks in extent_io.c
extent_io.c has debugging code to report and free leaked extent_state
and extent_buffer objects at rmmod time. This helps track down
leaks and it saves you from rebooting just to properly remove the
kmem_cache object.
But, the code runs under a fairly expensive spinlock and the checks to
see if it is currently enabled are not entirely consistent. Some use
#ifdef and some #if.
This changes everything to #if and disables the leak checking.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
-rw-r--r-- | fs/btrfs/extent_io.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index a3b0676403f7..2ea7f052722c 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -30,7 +30,7 @@ static LIST_HEAD(buffers); | |||
30 | static LIST_HEAD(states); | 30 | static LIST_HEAD(states); |
31 | 31 | ||
32 | #define LEAK_DEBUG 0 | 32 | #define LEAK_DEBUG 0 |
33 | #ifdef LEAK_DEBUG | 33 | #if LEAK_DEBUG |
34 | static DEFINE_SPINLOCK(leak_lock); | 34 | static DEFINE_SPINLOCK(leak_lock); |
35 | #endif | 35 | #endif |
36 | 36 | ||
@@ -119,7 +119,7 @@ void extent_io_tree_init(struct extent_io_tree *tree, | |||
119 | static struct extent_state *alloc_extent_state(gfp_t mask) | 119 | static struct extent_state *alloc_extent_state(gfp_t mask) |
120 | { | 120 | { |
121 | struct extent_state *state; | 121 | struct extent_state *state; |
122 | #ifdef LEAK_DEBUG | 122 | #if LEAK_DEBUG |
123 | unsigned long flags; | 123 | unsigned long flags; |
124 | #endif | 124 | #endif |
125 | 125 | ||
@@ -129,7 +129,7 @@ static struct extent_state *alloc_extent_state(gfp_t mask) | |||
129 | state->state = 0; | 129 | state->state = 0; |
130 | state->private = 0; | 130 | state->private = 0; |
131 | state->tree = NULL; | 131 | state->tree = NULL; |
132 | #ifdef LEAK_DEBUG | 132 | #if LEAK_DEBUG |
133 | spin_lock_irqsave(&leak_lock, flags); | 133 | spin_lock_irqsave(&leak_lock, flags); |
134 | list_add(&state->leak_list, &states); | 134 | list_add(&state->leak_list, &states); |
135 | spin_unlock_irqrestore(&leak_lock, flags); | 135 | spin_unlock_irqrestore(&leak_lock, flags); |
@@ -144,11 +144,11 @@ static void free_extent_state(struct extent_state *state) | |||
144 | if (!state) | 144 | if (!state) |
145 | return; | 145 | return; |
146 | if (atomic_dec_and_test(&state->refs)) { | 146 | if (atomic_dec_and_test(&state->refs)) { |
147 | #ifdef LEAK_DEBUG | 147 | #if LEAK_DEBUG |
148 | unsigned long flags; | 148 | unsigned long flags; |
149 | #endif | 149 | #endif |
150 | WARN_ON(state->tree); | 150 | WARN_ON(state->tree); |
151 | #ifdef LEAK_DEBUG | 151 | #if LEAK_DEBUG |
152 | spin_lock_irqsave(&leak_lock, flags); | 152 | spin_lock_irqsave(&leak_lock, flags); |
153 | list_del(&state->leak_list); | 153 | list_del(&state->leak_list); |
154 | spin_unlock_irqrestore(&leak_lock, flags); | 154 | spin_unlock_irqrestore(&leak_lock, flags); |
@@ -2983,7 +2983,7 @@ static struct extent_buffer *__alloc_extent_buffer(struct extent_io_tree *tree, | |||
2983 | gfp_t mask) | 2983 | gfp_t mask) |
2984 | { | 2984 | { |
2985 | struct extent_buffer *eb = NULL; | 2985 | struct extent_buffer *eb = NULL; |
2986 | #ifdef LEAK_DEBUG | 2986 | #if LEAK_DEBUG |
2987 | unsigned long flags; | 2987 | unsigned long flags; |
2988 | #endif | 2988 | #endif |
2989 | 2989 | ||
@@ -2991,7 +2991,7 @@ static struct extent_buffer *__alloc_extent_buffer(struct extent_io_tree *tree, | |||
2991 | eb->start = start; | 2991 | eb->start = start; |
2992 | eb->len = len; | 2992 | eb->len = len; |
2993 | mutex_init(&eb->mutex); | 2993 | mutex_init(&eb->mutex); |
2994 | #ifdef LEAK_DEBUG | 2994 | #if LEAK_DEBUG |
2995 | spin_lock_irqsave(&leak_lock, flags); | 2995 | spin_lock_irqsave(&leak_lock, flags); |
2996 | list_add(&eb->leak_list, &buffers); | 2996 | list_add(&eb->leak_list, &buffers); |
2997 | spin_unlock_irqrestore(&leak_lock, flags); | 2997 | spin_unlock_irqrestore(&leak_lock, flags); |
@@ -3003,7 +3003,7 @@ static struct extent_buffer *__alloc_extent_buffer(struct extent_io_tree *tree, | |||
3003 | 3003 | ||
3004 | static void __free_extent_buffer(struct extent_buffer *eb) | 3004 | static void __free_extent_buffer(struct extent_buffer *eb) |
3005 | { | 3005 | { |
3006 | #ifdef LEAK_DEBUG | 3006 | #if LEAK_DEBUG |
3007 | unsigned long flags; | 3007 | unsigned long flags; |
3008 | spin_lock_irqsave(&leak_lock, flags); | 3008 | spin_lock_irqsave(&leak_lock, flags); |
3009 | list_del(&eb->leak_list); | 3009 | list_del(&eb->leak_list); |