aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext2/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext2/super.c')
-rw-r--r--fs/ext2/super.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index a6c4d6e02324..ee4ba759581e 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -834,9 +834,6 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
834 printk ("EXT2-fs: not enough memory\n"); 834 printk ("EXT2-fs: not enough memory\n");
835 goto failed_mount; 835 goto failed_mount;
836 } 836 }
837 percpu_counter_init(&sbi->s_freeblocks_counter);
838 percpu_counter_init(&sbi->s_freeinodes_counter);
839 percpu_counter_init(&sbi->s_dirs_counter);
840 bgl_lock_init(&sbi->s_blockgroup_lock); 837 bgl_lock_init(&sbi->s_blockgroup_lock);
841 sbi->s_debts = kmalloc(sbi->s_groups_count * sizeof(*sbi->s_debts), 838 sbi->s_debts = kmalloc(sbi->s_groups_count * sizeof(*sbi->s_debts),
842 GFP_KERNEL); 839 GFP_KERNEL);
@@ -863,6 +860,13 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
863 sbi->s_gdb_count = db_count; 860 sbi->s_gdb_count = db_count;
864 get_random_bytes(&sbi->s_next_generation, sizeof(u32)); 861 get_random_bytes(&sbi->s_next_generation, sizeof(u32));
865 spin_lock_init(&sbi->s_next_gen_lock); 862 spin_lock_init(&sbi->s_next_gen_lock);
863
864 percpu_counter_init(&sbi->s_freeblocks_counter,
865 ext2_count_free_blocks(sb));
866 percpu_counter_init(&sbi->s_freeinodes_counter,
867 ext2_count_free_inodes(sb));
868 percpu_counter_init(&sbi->s_dirs_counter,
869 ext2_count_dirs(sb));
866 /* 870 /*
867 * set up enough so that it can read an inode 871 * set up enough so that it can read an inode
868 */ 872 */
@@ -874,24 +878,18 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
874 if (!sb->s_root) { 878 if (!sb->s_root) {
875 iput(root); 879 iput(root);
876 printk(KERN_ERR "EXT2-fs: get root inode failed\n"); 880 printk(KERN_ERR "EXT2-fs: get root inode failed\n");
877 goto failed_mount2; 881 goto failed_mount3;
878 } 882 }
879 if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) { 883 if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) {
880 dput(sb->s_root); 884 dput(sb->s_root);
881 sb->s_root = NULL; 885 sb->s_root = NULL;
882 printk(KERN_ERR "EXT2-fs: corrupt root inode, run e2fsck\n"); 886 printk(KERN_ERR "EXT2-fs: corrupt root inode, run e2fsck\n");
883 goto failed_mount2; 887 goto failed_mount3;
884 } 888 }
885 if (EXT2_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) 889 if (EXT2_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_HAS_JOURNAL))
886 ext2_warning(sb, __FUNCTION__, 890 ext2_warning(sb, __FUNCTION__,
887 "mounting ext3 filesystem as ext2"); 891 "mounting ext3 filesystem as ext2");
888 ext2_setup_super (sb, es, sb->s_flags & MS_RDONLY); 892 ext2_setup_super (sb, es, sb->s_flags & MS_RDONLY);
889 percpu_counter_mod(&sbi->s_freeblocks_counter,
890 ext2_count_free_blocks(sb));
891 percpu_counter_mod(&sbi->s_freeinodes_counter,
892 ext2_count_free_inodes(sb));
893 percpu_counter_mod(&sbi->s_dirs_counter,
894 ext2_count_dirs(sb));
895 return 0; 893 return 0;
896 894
897cantfind_ext2: 895cantfind_ext2:
@@ -899,7 +897,10 @@ cantfind_ext2:
899 printk("VFS: Can't find an ext2 filesystem on dev %s.\n", 897 printk("VFS: Can't find an ext2 filesystem on dev %s.\n",
900 sb->s_id); 898 sb->s_id);
901 goto failed_mount; 899 goto failed_mount;
902 900failed_mount3:
901 percpu_counter_destroy(&sbi->s_freeblocks_counter);
902 percpu_counter_destroy(&sbi->s_freeinodes_counter);
903 percpu_counter_destroy(&sbi->s_dirs_counter);
903failed_mount2: 904failed_mount2:
904 for (i = 0; i < db_count; i++) 905 for (i = 0; i < db_count; i++)
905 brelse(sbi->s_group_desc[i]); 906 brelse(sbi->s_group_desc[i]);