diff options
Diffstat (limited to 'fs/ext4/balloc.c')
-rw-r--r-- | fs/ext4/balloc.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index 0762d143e252..fca382037ddd 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c | |||
@@ -194,7 +194,16 @@ static void ext4_init_block_bitmap(struct super_block *sb, | |||
194 | if (!ext4_group_desc_csum_verify(sb, block_group, gdp)) { | 194 | if (!ext4_group_desc_csum_verify(sb, block_group, gdp)) { |
195 | ext4_error(sb, "Checksum bad for group %u", block_group); | 195 | ext4_error(sb, "Checksum bad for group %u", block_group); |
196 | grp = ext4_get_group_info(sb, block_group); | 196 | grp = ext4_get_group_info(sb, block_group); |
197 | if (!EXT4_MB_GRP_BBITMAP_CORRUPT(grp)) | ||
198 | percpu_counter_sub(&sbi->s_freeclusters_counter, | ||
199 | grp->bb_free); | ||
197 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); | 200 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); |
201 | if (!EXT4_MB_GRP_IBITMAP_CORRUPT(grp)) { | ||
202 | int count; | ||
203 | count = ext4_free_inodes_count(sb, gdp); | ||
204 | percpu_counter_sub(&sbi->s_freeinodes_counter, | ||
205 | count); | ||
206 | } | ||
198 | set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state); | 207 | set_bit(EXT4_GROUP_INFO_IBITMAP_CORRUPT_BIT, &grp->bb_state); |
199 | return; | 208 | return; |
200 | } | 209 | } |
@@ -359,6 +368,7 @@ static void ext4_validate_block_bitmap(struct super_block *sb, | |||
359 | { | 368 | { |
360 | ext4_fsblk_t blk; | 369 | ext4_fsblk_t blk; |
361 | struct ext4_group_info *grp = ext4_get_group_info(sb, block_group); | 370 | struct ext4_group_info *grp = ext4_get_group_info(sb, block_group); |
371 | struct ext4_sb_info *sbi = EXT4_SB(sb); | ||
362 | 372 | ||
363 | if (buffer_verified(bh)) | 373 | if (buffer_verified(bh)) |
364 | return; | 374 | return; |
@@ -369,6 +379,9 @@ static void ext4_validate_block_bitmap(struct super_block *sb, | |||
369 | ext4_unlock_group(sb, block_group); | 379 | ext4_unlock_group(sb, block_group); |
370 | ext4_error(sb, "bg %u: block %llu: invalid block bitmap", | 380 | ext4_error(sb, "bg %u: block %llu: invalid block bitmap", |
371 | block_group, blk); | 381 | block_group, blk); |
382 | if (!EXT4_MB_GRP_BBITMAP_CORRUPT(grp)) | ||
383 | percpu_counter_sub(&sbi->s_freeclusters_counter, | ||
384 | grp->bb_free); | ||
372 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); | 385 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); |
373 | return; | 386 | return; |
374 | } | 387 | } |
@@ -376,6 +389,9 @@ static void ext4_validate_block_bitmap(struct super_block *sb, | |||
376 | desc, bh))) { | 389 | desc, bh))) { |
377 | ext4_unlock_group(sb, block_group); | 390 | ext4_unlock_group(sb, block_group); |
378 | ext4_error(sb, "bg %u: bad block bitmap checksum", block_group); | 391 | ext4_error(sb, "bg %u: bad block bitmap checksum", block_group); |
392 | if (!EXT4_MB_GRP_BBITMAP_CORRUPT(grp)) | ||
393 | percpu_counter_sub(&sbi->s_freeclusters_counter, | ||
394 | grp->bb_free); | ||
379 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); | 395 | set_bit(EXT4_GROUP_INFO_BBITMAP_CORRUPT_BIT, &grp->bb_state); |
380 | return; | 396 | return; |
381 | } | 397 | } |