diff options
Diffstat (limited to 'fs/ext4/block_validity.c')
-rw-r--r-- | fs/ext4/block_validity.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c index 50784ef07563..538c48655084 100644 --- a/fs/ext4/block_validity.c +++ b/fs/ext4/block_validity.c | |||
@@ -16,9 +16,9 @@ | |||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/swap.h> | 17 | #include <linux/swap.h> |
18 | #include <linux/pagemap.h> | 18 | #include <linux/pagemap.h> |
19 | #include <linux/version.h> | ||
20 | #include <linux/blkdev.h> | 19 | #include <linux/blkdev.h> |
21 | #include <linux/mutex.h> | 20 | #include <linux/mutex.h> |
21 | #include <linux/slab.h> | ||
22 | #include "ext4.h" | 22 | #include "ext4.h" |
23 | 23 | ||
24 | struct ext4_system_zone { | 24 | struct ext4_system_zone { |
@@ -160,7 +160,7 @@ int ext4_setup_system_zone(struct super_block *sb) | |||
160 | if (ext4_bg_has_super(sb, i) && | 160 | if (ext4_bg_has_super(sb, i) && |
161 | ((i < 5) || ((i % flex_size) == 0))) | 161 | ((i < 5) || ((i % flex_size) == 0))) |
162 | add_system_zone(sbi, ext4_group_first_block_no(sb, i), | 162 | add_system_zone(sbi, ext4_group_first_block_no(sb, i), |
163 | sbi->s_gdb_count + 1); | 163 | ext4_bg_num_gdb(sb, i) + 1); |
164 | gdp = ext4_get_group_desc(sb, i, NULL); | 164 | gdp = ext4_get_group_desc(sb, i, NULL); |
165 | ret = add_system_zone(sbi, ext4_block_bitmap(sb, gdp), 1); | 165 | ret = add_system_zone(sbi, ext4_block_bitmap(sb, gdp), 1); |
166 | if (ret) | 166 | if (ret) |
@@ -206,14 +206,14 @@ void ext4_release_system_zone(struct super_block *sb) | |||
206 | entry = rb_entry(n, struct ext4_system_zone, node); | 206 | entry = rb_entry(n, struct ext4_system_zone, node); |
207 | kmem_cache_free(ext4_system_zone_cachep, entry); | 207 | kmem_cache_free(ext4_system_zone_cachep, entry); |
208 | if (!parent) | 208 | if (!parent) |
209 | EXT4_SB(sb)->system_blks.rb_node = NULL; | 209 | EXT4_SB(sb)->system_blks = RB_ROOT; |
210 | else if (parent->rb_left == n) | 210 | else if (parent->rb_left == n) |
211 | parent->rb_left = NULL; | 211 | parent->rb_left = NULL; |
212 | else if (parent->rb_right == n) | 212 | else if (parent->rb_right == n) |
213 | parent->rb_right = NULL; | 213 | parent->rb_right = NULL; |
214 | n = parent; | 214 | n = parent; |
215 | } | 215 | } |
216 | EXT4_SB(sb)->system_blks.rb_node = NULL; | 216 | EXT4_SB(sb)->system_blks = RB_ROOT; |
217 | } | 217 | } |
218 | 218 | ||
219 | /* | 219 | /* |
@@ -228,6 +228,7 @@ int ext4_data_block_valid(struct ext4_sb_info *sbi, ext4_fsblk_t start_blk, | |||
228 | struct rb_node *n = sbi->system_blks.rb_node; | 228 | struct rb_node *n = sbi->system_blks.rb_node; |
229 | 229 | ||
230 | if ((start_blk <= le32_to_cpu(sbi->s_es->s_first_data_block)) || | 230 | if ((start_blk <= le32_to_cpu(sbi->s_es->s_first_data_block)) || |
231 | (start_blk + count < start_blk) || | ||
231 | (start_blk + count > ext4_blocks_count(sbi->s_es))) | 232 | (start_blk + count > ext4_blocks_count(sbi->s_es))) |
232 | return 0; | 233 | return 0; |
233 | while (n) { | 234 | while (n) { |