aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorDmitry Monakhov <dmonakhov@openvz.org>2010-05-16 08:00:00 -0400
committerTheodore Ts'o <tytso@mit.edu>2010-05-16 08:00:00 -0400
commit84061e07c5fbbbf9dc8aef8fb750fc3a2dfc31f3 (patch)
tree91f3e08999ea72b51b246c521ffc31d2c55eea90 /fs/ext4
parentd17413c08cd2b1dd2bf2cfdbb0f7b736b2b2b15c (diff)
ext4: init statistics after journal recovery
Currently block/inode/dir counters initialized before journal was recovered. In fact after journal recovery this info will probably change. And freeblocks it critical for correct delalloc mode accounting. https://bugzilla.kernel.org/show_bug.cgi?id=15768 Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> Acked-by: Jan Kara <jack@suse.cz> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/super.c40
1 files changed, 18 insertions, 22 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 00d09f58f188..d83cdcbd9b31 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2794,24 +2794,6 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2794 get_random_bytes(&sbi->s_next_generation, sizeof(u32)); 2794 get_random_bytes(&sbi->s_next_generation, sizeof(u32));
2795 spin_lock_init(&sbi->s_next_gen_lock); 2795 spin_lock_init(&sbi->s_next_gen_lock);
2796 2796
2797 err = percpu_counter_init(&sbi->s_freeblocks_counter,
2798 ext4_count_free_blocks(sb));
2799 if (!err) {
2800 err = percpu_counter_init(&sbi->s_freeinodes_counter,
2801 ext4_count_free_inodes(sb));
2802 }
2803 if (!err) {
2804 err = percpu_counter_init(&sbi->s_dirs_counter,
2805 ext4_count_dirs(sb));
2806 }
2807 if (!err) {
2808 err = percpu_counter_init(&sbi->s_dirtyblocks_counter, 0);
2809 }
2810 if (err) {
2811 ext4_msg(sb, KERN_ERR, "insufficient memory");
2812 goto failed_mount3;
2813 }
2814
2815 sbi->s_stripe = ext4_get_stripe_size(sbi); 2797 sbi->s_stripe = ext4_get_stripe_size(sbi);
2816 sbi->s_max_writeback_mb_bump = 128; 2798 sbi->s_max_writeback_mb_bump = 128;
2817 2799
@@ -2911,6 +2893,20 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2911 set_task_ioprio(sbi->s_journal->j_task, journal_ioprio); 2893 set_task_ioprio(sbi->s_journal->j_task, journal_ioprio);
2912 2894
2913no_journal: 2895no_journal:
2896 err = percpu_counter_init(&sbi->s_freeblocks_counter,
2897 ext4_count_free_blocks(sb));
2898 if (!err)
2899 err = percpu_counter_init(&sbi->s_freeinodes_counter,
2900 ext4_count_free_inodes(sb));
2901 if (!err)
2902 err = percpu_counter_init(&sbi->s_dirs_counter,
2903 ext4_count_dirs(sb));
2904 if (!err)
2905 err = percpu_counter_init(&sbi->s_dirtyblocks_counter, 0);
2906 if (err) {
2907 ext4_msg(sb, KERN_ERR, "insufficient memory");
2908 goto failed_mount_wq;
2909 }
2914 if (test_opt(sb, NOBH)) { 2910 if (test_opt(sb, NOBH)) {
2915 if (!(test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)) { 2911 if (!(test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA)) {
2916 ext4_msg(sb, KERN_WARNING, "Ignoring nobh option - " 2912 ext4_msg(sb, KERN_WARNING, "Ignoring nobh option - "
@@ -3060,6 +3056,10 @@ failed_mount_wq:
3060 jbd2_journal_destroy(sbi->s_journal); 3056 jbd2_journal_destroy(sbi->s_journal);
3061 sbi->s_journal = NULL; 3057 sbi->s_journal = NULL;
3062 } 3058 }
3059 percpu_counter_destroy(&sbi->s_freeblocks_counter);
3060 percpu_counter_destroy(&sbi->s_freeinodes_counter);
3061 percpu_counter_destroy(&sbi->s_dirs_counter);
3062 percpu_counter_destroy(&sbi->s_dirtyblocks_counter);
3063failed_mount3: 3063failed_mount3:
3064 if (sbi->s_flex_groups) { 3064 if (sbi->s_flex_groups) {
3065 if (is_vmalloc_addr(sbi->s_flex_groups)) 3065 if (is_vmalloc_addr(sbi->s_flex_groups))
@@ -3067,10 +3067,6 @@ failed_mount3:
3067 else 3067 else
3068 kfree(sbi->s_flex_groups); 3068 kfree(sbi->s_flex_groups);
3069 } 3069 }
3070 percpu_counter_destroy(&sbi->s_freeblocks_counter);
3071 percpu_counter_destroy(&sbi->s_freeinodes_counter);
3072 percpu_counter_destroy(&sbi->s_dirs_counter);
3073 percpu_counter_destroy(&sbi->s_dirtyblocks_counter);
3074failed_mount2: 3070failed_mount2:
3075 for (i = 0; i < db_count; i++) 3071 for (i = 0; i < db_count; i++)
3076 brelse(sbi->s_group_desc[i]); 3072 brelse(sbi->s_group_desc[i]);