diff options
Diffstat (limited to 'fs/ext4/block_validity.c')
-rw-r--r-- | fs/ext4/block_validity.c | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c index 3f11656bd72e..41eb9dcfac7e 100644 --- a/fs/ext4/block_validity.c +++ b/fs/ext4/block_validity.c | |||
@@ -180,37 +180,12 @@ int ext4_setup_system_zone(struct super_block *sb) | |||
180 | /* Called when the filesystem is unmounted */ | 180 | /* Called when the filesystem is unmounted */ |
181 | void ext4_release_system_zone(struct super_block *sb) | 181 | void ext4_release_system_zone(struct super_block *sb) |
182 | { | 182 | { |
183 | struct rb_node *n = EXT4_SB(sb)->system_blks.rb_node; | 183 | struct ext4_system_zone *entry, *n; |
184 | struct rb_node *parent; | ||
185 | struct ext4_system_zone *entry; | ||
186 | 184 | ||
187 | while (n) { | 185 | rbtree_postorder_for_each_entry_safe(entry, n, |
188 | /* Do the node's children first */ | 186 | &EXT4_SB(sb)->system_blks, node) |
189 | if (n->rb_left) { | ||
190 | n = n->rb_left; | ||
191 | continue; | ||
192 | } | ||
193 | if (n->rb_right) { | ||
194 | n = n->rb_right; | ||
195 | continue; | ||
196 | } | ||
197 | /* | ||
198 | * The node has no children; free it, and then zero | ||
199 | * out parent's link to it. Finally go to the | ||
200 | * beginning of the loop and try to free the parent | ||
201 | * node. | ||
202 | */ | ||
203 | parent = rb_parent(n); | ||
204 | entry = rb_entry(n, struct ext4_system_zone, node); | ||
205 | kmem_cache_free(ext4_system_zone_cachep, entry); | 187 | kmem_cache_free(ext4_system_zone_cachep, entry); |
206 | if (!parent) | 188 | |
207 | EXT4_SB(sb)->system_blks = RB_ROOT; | ||
208 | else if (parent->rb_left == n) | ||
209 | parent->rb_left = NULL; | ||
210 | else if (parent->rb_right == n) | ||
211 | parent->rb_right = NULL; | ||
212 | n = parent; | ||
213 | } | ||
214 | EXT4_SB(sb)->system_blks = RB_ROOT; | 189 | EXT4_SB(sb)->system_blks = RB_ROOT; |
215 | } | 190 | } |
216 | 191 | ||