diff options
Diffstat (limited to 'fs/ext2')
-rw-r--r-- | fs/ext2/balloc.c | 73 | ||||
-rw-r--r-- | fs/ext2/ialloc.c | 40 | ||||
-rw-r--r-- | fs/ext2/super.c | 16 |
3 files changed, 1 insertions, 128 deletions
diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c index 6591abef64d0..bb6908066494 100644 --- a/fs/ext2/balloc.c +++ b/fs/ext2/balloc.c | |||
@@ -624,76 +624,3 @@ unsigned long ext2_bg_num_gdb(struct super_block *sb, int group) | |||
624 | return EXT2_SB(sb)->s_gdb_count; | 624 | return EXT2_SB(sb)->s_gdb_count; |
625 | } | 625 | } |
626 | 626 | ||
627 | #ifdef CONFIG_EXT2_CHECK | ||
628 | /* Called at mount-time, super-block is locked */ | ||
629 | void ext2_check_blocks_bitmap (struct super_block * sb) | ||
630 | { | ||
631 | struct buffer_head *bitmap_bh = NULL; | ||
632 | struct ext2_super_block * es; | ||
633 | unsigned long desc_count, bitmap_count, x, j; | ||
634 | unsigned long desc_blocks; | ||
635 | struct ext2_group_desc * desc; | ||
636 | int i; | ||
637 | |||
638 | es = EXT2_SB(sb)->s_es; | ||
639 | desc_count = 0; | ||
640 | bitmap_count = 0; | ||
641 | desc = NULL; | ||
642 | for (i = 0; i < EXT2_SB(sb)->s_groups_count; i++) { | ||
643 | desc = ext2_get_group_desc (sb, i, NULL); | ||
644 | if (!desc) | ||
645 | continue; | ||
646 | desc_count += le16_to_cpu(desc->bg_free_blocks_count); | ||
647 | brelse(bitmap_bh); | ||
648 | bitmap_bh = read_block_bitmap(sb, i); | ||
649 | if (!bitmap_bh) | ||
650 | continue; | ||
651 | |||
652 | if (ext2_bg_has_super(sb, i) && | ||
653 | !ext2_test_bit(0, bitmap_bh->b_data)) | ||
654 | ext2_error(sb, __FUNCTION__, | ||
655 | "Superblock in group %d is marked free", i); | ||
656 | |||
657 | desc_blocks = ext2_bg_num_gdb(sb, i); | ||
658 | for (j = 0; j < desc_blocks; j++) | ||
659 | if (!ext2_test_bit(j + 1, bitmap_bh->b_data)) | ||
660 | ext2_error(sb, __FUNCTION__, | ||
661 | "Descriptor block #%ld in group " | ||
662 | "%d is marked free", j, i); | ||
663 | |||
664 | if (!block_in_use(le32_to_cpu(desc->bg_block_bitmap), | ||
665 | sb, bitmap_bh->b_data)) | ||
666 | ext2_error(sb, "ext2_check_blocks_bitmap", | ||
667 | "Block bitmap for group %d is marked free", | ||
668 | i); | ||
669 | |||
670 | if (!block_in_use(le32_to_cpu(desc->bg_inode_bitmap), | ||
671 | sb, bitmap_bh->b_data)) | ||
672 | ext2_error(sb, "ext2_check_blocks_bitmap", | ||
673 | "Inode bitmap for group %d is marked free", | ||
674 | i); | ||
675 | |||
676 | for (j = 0; j < EXT2_SB(sb)->s_itb_per_group; j++) | ||
677 | if (!block_in_use(le32_to_cpu(desc->bg_inode_table) + j, | ||
678 | sb, bitmap_bh->b_data)) | ||
679 | ext2_error (sb, "ext2_check_blocks_bitmap", | ||
680 | "Block #%ld of the inode table in " | ||
681 | "group %d is marked free", j, i); | ||
682 | |||
683 | x = ext2_count_free(bitmap_bh, sb->s_blocksize); | ||
684 | if (le16_to_cpu(desc->bg_free_blocks_count) != x) | ||
685 | ext2_error (sb, "ext2_check_blocks_bitmap", | ||
686 | "Wrong free blocks count for group %d, " | ||
687 | "stored = %d, counted = %lu", i, | ||
688 | le16_to_cpu(desc->bg_free_blocks_count), x); | ||
689 | bitmap_count += x; | ||
690 | } | ||
691 | if (le32_to_cpu(es->s_free_blocks_count) != bitmap_count) | ||
692 | ext2_error (sb, "ext2_check_blocks_bitmap", | ||
693 | "Wrong free blocks count in super block, " | ||
694 | "stored = %lu, counted = %lu", | ||
695 | (unsigned long)le32_to_cpu(es->s_free_blocks_count), | ||
696 | bitmap_count); | ||
697 | brelse(bitmap_bh); | ||
698 | } | ||
699 | #endif | ||
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c index e2d6208633a7..74714af4ae69 100644 --- a/fs/ext2/ialloc.c +++ b/fs/ext2/ialloc.c | |||
@@ -700,43 +700,3 @@ unsigned long ext2_count_dirs (struct super_block * sb) | |||
700 | return count; | 700 | return count; |
701 | } | 701 | } |
702 | 702 | ||
703 | #ifdef CONFIG_EXT2_CHECK | ||
704 | /* Called at mount-time, super-block is locked */ | ||
705 | void ext2_check_inodes_bitmap (struct super_block * sb) | ||
706 | { | ||
707 | struct ext2_super_block * es = EXT2_SB(sb)->s_es; | ||
708 | unsigned long desc_count = 0, bitmap_count = 0; | ||
709 | struct buffer_head *bitmap_bh = NULL; | ||
710 | int i; | ||
711 | |||
712 | for (i = 0; i < EXT2_SB(sb)->s_groups_count; i++) { | ||
713 | struct ext2_group_desc *desc; | ||
714 | unsigned x; | ||
715 | |||
716 | desc = ext2_get_group_desc(sb, i, NULL); | ||
717 | if (!desc) | ||
718 | continue; | ||
719 | desc_count += le16_to_cpu(desc->bg_free_inodes_count); | ||
720 | brelse(bitmap_bh); | ||
721 | bitmap_bh = read_inode_bitmap(sb, i); | ||
722 | if (!bitmap_bh) | ||
723 | continue; | ||
724 | |||
725 | x = ext2_count_free(bitmap_bh, EXT2_INODES_PER_GROUP(sb) / 8); | ||
726 | if (le16_to_cpu(desc->bg_free_inodes_count) != x) | ||
727 | ext2_error (sb, "ext2_check_inodes_bitmap", | ||
728 | "Wrong free inodes count in group %d, " | ||
729 | "stored = %d, counted = %lu", i, | ||
730 | le16_to_cpu(desc->bg_free_inodes_count), x); | ||
731 | bitmap_count += x; | ||
732 | } | ||
733 | brelse(bitmap_bh); | ||
734 | if (percpu_counter_read(&EXT2_SB(sb)->s_freeinodes_counter) != | ||
735 | bitmap_count) | ||
736 | ext2_error(sb, "ext2_check_inodes_bitmap", | ||
737 | "Wrong free inodes count in super block, " | ||
738 | "stored = %lu, counted = %lu", | ||
739 | (unsigned long)le32_to_cpu(es->s_free_inodes_count), | ||
740 | bitmap_count); | ||
741 | } | ||
742 | #endif | ||
diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 3c0c7c6a5b44..e4ed4b31a433 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c | |||
@@ -281,7 +281,7 @@ static unsigned long get_sb_block(void **data) | |||
281 | enum { | 281 | enum { |
282 | Opt_bsd_df, Opt_minix_df, Opt_grpid, Opt_nogrpid, | 282 | Opt_bsd_df, Opt_minix_df, Opt_grpid, Opt_nogrpid, |
283 | Opt_resgid, Opt_resuid, Opt_sb, Opt_err_cont, Opt_err_panic, | 283 | Opt_resgid, Opt_resuid, Opt_sb, Opt_err_cont, Opt_err_panic, |
284 | Opt_err_ro, Opt_nouid32, Opt_check, Opt_nocheck, Opt_debug, | 284 | Opt_err_ro, Opt_nouid32, Opt_nocheck, Opt_debug, |
285 | Opt_oldalloc, Opt_orlov, Opt_nobh, Opt_user_xattr, Opt_nouser_xattr, | 285 | Opt_oldalloc, Opt_orlov, Opt_nobh, Opt_user_xattr, Opt_nouser_xattr, |
286 | Opt_acl, Opt_noacl, Opt_xip, Opt_ignore, Opt_err, Opt_quota, | 286 | Opt_acl, Opt_noacl, Opt_xip, Opt_ignore, Opt_err, Opt_quota, |
287 | Opt_usrquota, Opt_grpquota | 287 | Opt_usrquota, Opt_grpquota |
@@ -303,7 +303,6 @@ static match_table_t tokens = { | |||
303 | {Opt_nouid32, "nouid32"}, | 303 | {Opt_nouid32, "nouid32"}, |
304 | {Opt_nocheck, "check=none"}, | 304 | {Opt_nocheck, "check=none"}, |
305 | {Opt_nocheck, "nocheck"}, | 305 | {Opt_nocheck, "nocheck"}, |
306 | {Opt_check, "check"}, | ||
307 | {Opt_debug, "debug"}, | 306 | {Opt_debug, "debug"}, |
308 | {Opt_oldalloc, "oldalloc"}, | 307 | {Opt_oldalloc, "oldalloc"}, |
309 | {Opt_orlov, "orlov"}, | 308 | {Opt_orlov, "orlov"}, |
@@ -376,13 +375,6 @@ static int parse_options (char * options, | |||
376 | case Opt_nouid32: | 375 | case Opt_nouid32: |
377 | set_opt (sbi->s_mount_opt, NO_UID32); | 376 | set_opt (sbi->s_mount_opt, NO_UID32); |
378 | break; | 377 | break; |
379 | case Opt_check: | ||
380 | #ifdef CONFIG_EXT2_CHECK | ||
381 | set_opt (sbi->s_mount_opt, CHECK); | ||
382 | #else | ||
383 | printk("EXT2 Check option not supported\n"); | ||
384 | #endif | ||
385 | break; | ||
386 | case Opt_nocheck: | 378 | case Opt_nocheck: |
387 | clear_opt (sbi->s_mount_opt, CHECK); | 379 | clear_opt (sbi->s_mount_opt, CHECK); |
388 | break; | 380 | break; |
@@ -503,12 +495,6 @@ static int ext2_setup_super (struct super_block * sb, | |||
503 | EXT2_BLOCKS_PER_GROUP(sb), | 495 | EXT2_BLOCKS_PER_GROUP(sb), |
504 | EXT2_INODES_PER_GROUP(sb), | 496 | EXT2_INODES_PER_GROUP(sb), |
505 | sbi->s_mount_opt); | 497 | sbi->s_mount_opt); |
506 | #ifdef CONFIG_EXT2_CHECK | ||
507 | if (test_opt (sb, CHECK)) { | ||
508 | ext2_check_blocks_bitmap (sb); | ||
509 | ext2_check_inodes_bitmap (sb); | ||
510 | } | ||
511 | #endif | ||
512 | return res; | 498 | return res; |
513 | } | 499 | } |
514 | 500 | ||