diff options
Diffstat (limited to 'fs/ext4/block_validity.c')
-rw-r--r-- | fs/ext4/block_validity.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c index 538c48655084..3db5084db9bd 100644 --- a/fs/ext4/block_validity.c +++ b/fs/ext4/block_validity.c | |||
@@ -72,9 +72,9 @@ static int add_system_zone(struct ext4_sb_info *sbi, | |||
72 | else if (start_blk >= (entry->start_blk + entry->count)) | 72 | else if (start_blk >= (entry->start_blk + entry->count)) |
73 | n = &(*n)->rb_right; | 73 | n = &(*n)->rb_right; |
74 | else { | 74 | else { |
75 | if (start_blk + count > (entry->start_blk + | 75 | if (start_blk + count > (entry->start_blk + |
76 | entry->count)) | 76 | entry->count)) |
77 | entry->count = (start_blk + count - | 77 | entry->count = (start_blk + count - |
78 | entry->start_blk); | 78 | entry->start_blk); |
79 | new_node = *n; | 79 | new_node = *n; |
80 | new_entry = rb_entry(new_node, struct ext4_system_zone, | 80 | new_entry = rb_entry(new_node, struct ext4_system_zone, |
@@ -229,16 +229,20 @@ int ext4_data_block_valid(struct ext4_sb_info *sbi, ext4_fsblk_t start_blk, | |||
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 < start_blk) || |
232 | (start_blk + count > ext4_blocks_count(sbi->s_es))) | 232 | (start_blk + count > ext4_blocks_count(sbi->s_es))) { |
233 | sbi->s_es->s_last_error_block = cpu_to_le64(start_blk); | ||
233 | return 0; | 234 | return 0; |
235 | } | ||
234 | while (n) { | 236 | while (n) { |
235 | entry = rb_entry(n, struct ext4_system_zone, node); | 237 | entry = rb_entry(n, struct ext4_system_zone, node); |
236 | if (start_blk + count - 1 < entry->start_blk) | 238 | if (start_blk + count - 1 < entry->start_blk) |
237 | n = n->rb_left; | 239 | n = n->rb_left; |
238 | else if (start_blk >= (entry->start_blk + entry->count)) | 240 | else if (start_blk >= (entry->start_blk + entry->count)) |
239 | n = n->rb_right; | 241 | n = n->rb_right; |
240 | else | 242 | else { |
243 | sbi->s_es->s_last_error_block = cpu_to_le64(start_blk); | ||
241 | return 0; | 244 | return 0; |
245 | } | ||
242 | } | 246 | } |
243 | return 1; | 247 | return 1; |
244 | } | 248 | } |