diff options
Diffstat (limited to 'fs/ext3')
-rw-r--r-- | fs/ext3/balloc.c | 73 | ||||
-rw-r--r-- | fs/ext3/ialloc.c | 41 | ||||
-rw-r--r-- | fs/ext3/super.c | 17 |
3 files changed, 1 insertions, 130 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 | ||
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c index df3f517c54ac..9e4a24376210 100644 --- a/fs/ext3/ialloc.c +++ b/fs/ext3/ialloc.c | |||
@@ -756,44 +756,3 @@ unsigned long ext3_count_dirs (struct super_block * sb) | |||
756 | return count; | 756 | return count; |
757 | } | 757 | } |
758 | 758 | ||
759 | #ifdef CONFIG_EXT3_CHECK | ||
760 | /* Called at mount-time, super-block is locked */ | ||
761 | void ext3_check_inodes_bitmap (struct super_block * sb) | ||
762 | { | ||
763 | struct ext3_super_block * es; | ||
764 | unsigned long desc_count, bitmap_count, x; | ||
765 | struct buffer_head *bitmap_bh = NULL; | ||
766 | struct ext3_group_desc * gdp; | ||
767 | int i; | ||
768 | |||
769 | es = EXT3_SB(sb)->s_es; | ||
770 | desc_count = 0; | ||
771 | bitmap_count = 0; | ||
772 | gdp = NULL; | ||
773 | for (i = 0; i < EXT3_SB(sb)->s_groups_count; i++) { | ||
774 | gdp = ext3_get_group_desc (sb, i, NULL); | ||
775 | if (!gdp) | ||
776 | continue; | ||
777 | desc_count += le16_to_cpu(gdp->bg_free_inodes_count); | ||
778 | brelse(bitmap_bh); | ||
779 | bitmap_bh = read_inode_bitmap(sb, i); | ||
780 | if (!bitmap_bh) | ||
781 | continue; | ||
782 | |||
783 | x = ext3_count_free(bitmap_bh, EXT3_INODES_PER_GROUP(sb) / 8); | ||
784 | if (le16_to_cpu(gdp->bg_free_inodes_count) != x) | ||
785 | ext3_error (sb, "ext3_check_inodes_bitmap", | ||
786 | "Wrong free inodes count in group %d, " | ||
787 | "stored = %d, counted = %lu", i, | ||
788 | le16_to_cpu(gdp->bg_free_inodes_count), x); | ||
789 | bitmap_count += x; | ||
790 | } | ||
791 | brelse(bitmap_bh); | ||
792 | if (le32_to_cpu(es->s_free_inodes_count) != bitmap_count) | ||
793 | ext3_error (sb, "ext3_check_inodes_bitmap", | ||
794 | "Wrong free inodes count in super block, " | ||
795 | "stored = %lu, counted = %lu", | ||
796 | (unsigned long)le32_to_cpu(es->s_free_inodes_count), | ||
797 | bitmap_count); | ||
798 | } | ||
799 | #endif | ||
diff --git a/fs/ext3/super.c b/fs/ext3/super.c index f594989ccb7a..4e6730622d90 100644 --- a/fs/ext3/super.c +++ b/fs/ext3/super.c | |||
@@ -625,7 +625,7 @@ static struct export_operations ext3_export_ops = { | |||
625 | enum { | 625 | enum { |
626 | Opt_bsd_df, Opt_minix_df, Opt_grpid, Opt_nogrpid, | 626 | Opt_bsd_df, Opt_minix_df, Opt_grpid, Opt_nogrpid, |
627 | Opt_resgid, Opt_resuid, Opt_sb, Opt_err_cont, Opt_err_panic, Opt_err_ro, | 627 | Opt_resgid, Opt_resuid, Opt_sb, Opt_err_cont, Opt_err_panic, Opt_err_ro, |
628 | Opt_nouid32, Opt_check, Opt_nocheck, Opt_debug, Opt_oldalloc, Opt_orlov, | 628 | Opt_nouid32, Opt_nocheck, Opt_debug, Opt_oldalloc, Opt_orlov, |
629 | Opt_user_xattr, Opt_nouser_xattr, Opt_acl, Opt_noacl, | 629 | Opt_user_xattr, Opt_nouser_xattr, Opt_acl, Opt_noacl, |
630 | Opt_reservation, Opt_noreservation, Opt_noload, Opt_nobh, | 630 | Opt_reservation, Opt_noreservation, Opt_noload, Opt_nobh, |
631 | Opt_commit, Opt_journal_update, Opt_journal_inum, | 631 | Opt_commit, Opt_journal_update, Opt_journal_inum, |
@@ -652,7 +652,6 @@ static match_table_t tokens = { | |||
652 | {Opt_nouid32, "nouid32"}, | 652 | {Opt_nouid32, "nouid32"}, |
653 | {Opt_nocheck, "nocheck"}, | 653 | {Opt_nocheck, "nocheck"}, |
654 | {Opt_nocheck, "check=none"}, | 654 | {Opt_nocheck, "check=none"}, |
655 | {Opt_check, "check"}, | ||
656 | {Opt_debug, "debug"}, | 655 | {Opt_debug, "debug"}, |
657 | {Opt_oldalloc, "oldalloc"}, | 656 | {Opt_oldalloc, "oldalloc"}, |
658 | {Opt_orlov, "orlov"}, | 657 | {Opt_orlov, "orlov"}, |
@@ -773,14 +772,6 @@ static int parse_options (char * options, struct super_block *sb, | |||
773 | case Opt_nouid32: | 772 | case Opt_nouid32: |
774 | set_opt (sbi->s_mount_opt, NO_UID32); | 773 | set_opt (sbi->s_mount_opt, NO_UID32); |
775 | break; | 774 | break; |
776 | case Opt_check: | ||
777 | #ifdef CONFIG_EXT3_CHECK | ||
778 | set_opt (sbi->s_mount_opt, CHECK); | ||
779 | #else | ||
780 | printk(KERN_ERR | ||
781 | "EXT3 Check option not supported\n"); | ||
782 | #endif | ||
783 | break; | ||
784 | case Opt_nocheck: | 775 | case Opt_nocheck: |
785 | clear_opt (sbi->s_mount_opt, CHECK); | 776 | clear_opt (sbi->s_mount_opt, CHECK); |
786 | break; | 777 | break; |
@@ -1115,12 +1106,6 @@ static int ext3_setup_super(struct super_block *sb, struct ext3_super_block *es, | |||
1115 | } else { | 1106 | } else { |
1116 | printk("internal journal\n"); | 1107 | printk("internal journal\n"); |
1117 | } | 1108 | } |
1118 | #ifdef CONFIG_EXT3_CHECK | ||
1119 | if (test_opt (sb, CHECK)) { | ||
1120 | ext3_check_blocks_bitmap (sb); | ||
1121 | ext3_check_inodes_bitmap (sb); | ||
1122 | } | ||
1123 | #endif | ||
1124 | return res; | 1109 | return res; |
1125 | } | 1110 | } |
1126 | 1111 | ||