diff options
Diffstat (limited to 'fs/ext3/balloc.c')
-rw-r--r-- | fs/ext3/balloc.c | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c index 7992d21e0e09..ae1148c24c53 100644 --- a/fs/ext3/balloc.c +++ b/fs/ext3/balloc.c | |||
@@ -1517,76 +1517,3 @@ unsigned long ext3_bg_num_gdb(struct super_block *sb, int group) | |||
1517 | return EXT3_SB(sb)->s_gdb_count; | 1517 | return EXT3_SB(sb)->s_gdb_count; |
1518 | } | 1518 | } |
1519 | 1519 | ||
1520 | #ifdef CONFIG_EXT3_CHECK | ||
1521 | /* Called at mount-time, super-block is locked */ | ||
1522 | void ext3_check_blocks_bitmap (struct super_block * sb) | ||
1523 | { | ||
1524 | struct ext3_super_block *es; | ||
1525 | unsigned long desc_count, bitmap_count, x, j; | ||
1526 | unsigned long desc_blocks; | ||
1527 | struct buffer_head *bitmap_bh = NULL; | ||
1528 | struct ext3_group_desc *gdp; | ||
1529 | int i; | ||
1530 | |||
1531 | es = EXT3_SB(sb)->s_es; | ||
1532 | desc_count = 0; | ||
1533 | bitmap_count = 0; | ||
1534 | gdp = NULL; | ||
1535 | for (i = 0; i < EXT3_SB(sb)->s_groups_count; i++) { | ||
1536 | gdp = ext3_get_group_desc (sb, i, NULL); | ||
1537 | if (!gdp) | ||
1538 | continue; | ||
1539 | desc_count += le16_to_cpu(gdp->bg_free_blocks_count); | ||
1540 | brelse(bitmap_bh); | ||
1541 | bitmap_bh = read_block_bitmap(sb, i); | ||
1542 | if (bitmap_bh == NULL) | ||
1543 | continue; | ||
1544 | |||
1545 | if (ext3_bg_has_super(sb, i) && | ||
1546 | !ext3_test_bit(0, bitmap_bh->b_data)) | ||
1547 | ext3_error(sb, __FUNCTION__, | ||
1548 | "Superblock in group %d is marked free", i); | ||
1549 | |||
1550 | desc_blocks = ext3_bg_num_gdb(sb, i); | ||
1551 | for (j = 0; j < desc_blocks; j++) | ||
1552 | if (!ext3_test_bit(j + 1, bitmap_bh->b_data)) | ||
1553 | ext3_error(sb, __FUNCTION__, | ||
1554 | "Descriptor block #%ld in group " | ||
1555 | "%d is marked free", j, i); | ||
1556 | |||
1557 | if (!block_in_use (le32_to_cpu(gdp->bg_block_bitmap), | ||
1558 | sb, bitmap_bh->b_data)) | ||
1559 | ext3_error (sb, "ext3_check_blocks_bitmap", | ||
1560 | "Block bitmap for group %d is marked free", | ||
1561 | i); | ||
1562 | |||
1563 | if (!block_in_use (le32_to_cpu(gdp->bg_inode_bitmap), | ||
1564 | sb, bitmap_bh->b_data)) | ||
1565 | ext3_error (sb, "ext3_check_blocks_bitmap", | ||
1566 | "Inode bitmap for group %d is marked free", | ||
1567 | i); | ||
1568 | |||
1569 | for (j = 0; j < EXT3_SB(sb)->s_itb_per_group; j++) | ||
1570 | if (!block_in_use (le32_to_cpu(gdp->bg_inode_table) + j, | ||
1571 | sb, bitmap_bh->b_data)) | ||
1572 | ext3_error (sb, "ext3_check_blocks_bitmap", | ||
1573 | "Block #%d of the inode table in " | ||
1574 | "group %d is marked free", j, i); | ||
1575 | |||
1576 | x = ext3_count_free(bitmap_bh, sb->s_blocksize); | ||
1577 | if (le16_to_cpu(gdp->bg_free_blocks_count) != x) | ||
1578 | ext3_error (sb, "ext3_check_blocks_bitmap", | ||
1579 | "Wrong free blocks count for group %d, " | ||
1580 | "stored = %d, counted = %lu", i, | ||
1581 | le16_to_cpu(gdp->bg_free_blocks_count), x); | ||
1582 | bitmap_count += x; | ||
1583 | } | ||
1584 | brelse(bitmap_bh); | ||
1585 | if (le32_to_cpu(es->s_free_blocks_count) != bitmap_count) | ||
1586 | ext3_error (sb, "ext3_check_blocks_bitmap", | ||
1587 | "Wrong free blocks count in super block, " | ||
1588 | "stored = %lu, counted = %lu", | ||
1589 | (unsigned long)le32_to_cpu(es->s_free_blocks_count), | ||
1590 | bitmap_count); | ||
1591 | } | ||
1592 | #endif | ||