Whamcloud - gitweb
LU-4557 ldiskfs: init statfs variables after journal
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / rhel6.3 / ext4-init-statfs-after-journal.patch
1 --- linux-stage.orig/fs/ext4/super.c    2014-02-14 04:48:50.707992991 +0800
2 +++ linux-stage/fs/ext4/super.c 2014-02-14 04:49:53.341999568 +0800
3 @@ -3456,24 +3456,6 @@ static int ext4_fill_super(struct super_
4         get_random_bytes(&sbi->s_next_generation, sizeof(u32));
5         spin_lock_init(&sbi->s_next_gen_lock);
6  
7 -       err = percpu_counter_init(&sbi->s_freeblocks_counter,
8 -                       ext4_count_free_blocks(sb));
9 -       if (!err) {
10 -               err = percpu_counter_init(&sbi->s_freeinodes_counter,
11 -                               ext4_count_free_inodes(sb));
12 -       }
13 -       if (!err) {
14 -               err = percpu_counter_init(&sbi->s_dirs_counter,
15 -                               ext4_count_dirs(sb));
16 -       }
17 -       if (!err) {
18 -               err = percpu_counter_init(&sbi->s_dirtyblocks_counter, 0);
19 -       }
20 -       if (err) {
21 -               ext4_msg(sb, KERN_ERR, "insufficient memory");
22 -               goto failed_mount3;
23 -       }
24 -
25         sbi->s_stripe = ext4_get_stripe_size(sbi);
26         sbi->s_max_writeback_mb_bump = 128;
27  
28 @@ -3555,6 +3537,24 @@ static int ext4_fill_super(struct super_
29                 goto no_journal;
30         }
31  
32 +       err = percpu_counter_init(&sbi->s_freeblocks_counter,
33 +                       ext4_count_free_blocks(sb));
34 +       if (!err) {
35 +               err = percpu_counter_init(&sbi->s_freeinodes_counter,
36 +                               ext4_count_free_inodes(sb));
37 +       }
38 +       if (!err) {
39 +               err = percpu_counter_init(&sbi->s_dirs_counter,
40 +                               ext4_count_dirs(sb));
41 +       }
42 +       if (!err) {
43 +               err = percpu_counter_init(&sbi->s_dirtyblocks_counter, 0);
44 +       }
45 +       if (err) {
46 +               ext4_msg(sb, KERN_ERR, "insufficient memory");
47 +               goto failed_mount4;
48 +       }
49 +
50         if (ext4_blocks_count(es) > 0xffffffffULL &&
51             !jbd2_journal_set_features(EXT4_SB(sb)->s_journal, 0, 0,
52                                        JBD2_FEATURE_INCOMPAT_64BIT)) {