diff options
author | Theodore Ts'o <tytso@mit.edu> | 2011-09-09 18:56:51 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2011-09-09 18:56:51 -0400 |
commit | 5704265188ffe4290ed73b3cb685206c3ed8209d (patch) | |
tree | 6bc51bea59625b2a7c8e4b74bbb66884371f74dd /fs/ext4/super.c | |
parent | 0aa060000e83ca3d09ddc446a7174fb0820d99bc (diff) |
ext4: convert s_{dirty,free}blocks_counter to s_{dirty,free}clusters_counter
Convert the percpu counters s_dirtyblocks_counter and
s_freeblocks_counter in struct ext4_super_info to be
s_dirtyclusters_counter and s_freeclusters_counter.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r-- | fs/ext4/super.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 25a4bfe3f39f..f81e7e791655 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -837,10 +837,10 @@ static void ext4_put_super(struct super_block *sb) | |||
837 | brelse(sbi->s_group_desc[i]); | 837 | brelse(sbi->s_group_desc[i]); |
838 | ext4_kvfree(sbi->s_group_desc); | 838 | ext4_kvfree(sbi->s_group_desc); |
839 | ext4_kvfree(sbi->s_flex_groups); | 839 | ext4_kvfree(sbi->s_flex_groups); |
840 | percpu_counter_destroy(&sbi->s_freeblocks_counter); | 840 | percpu_counter_destroy(&sbi->s_freeclusters_counter); |
841 | percpu_counter_destroy(&sbi->s_freeinodes_counter); | 841 | percpu_counter_destroy(&sbi->s_freeinodes_counter); |
842 | percpu_counter_destroy(&sbi->s_dirs_counter); | 842 | percpu_counter_destroy(&sbi->s_dirs_counter); |
843 | percpu_counter_destroy(&sbi->s_dirtyblocks_counter); | 843 | percpu_counter_destroy(&sbi->s_dirtyclusters_counter); |
844 | brelse(sbi->s_sbh); | 844 | brelse(sbi->s_sbh); |
845 | #ifdef CONFIG_QUOTA | 845 | #ifdef CONFIG_QUOTA |
846 | for (i = 0; i < MAXQUOTAS; i++) | 846 | for (i = 0; i < MAXQUOTAS; i++) |
@@ -2473,7 +2473,7 @@ static ssize_t delayed_allocation_blocks_show(struct ext4_attr *a, | |||
2473 | char *buf) | 2473 | char *buf) |
2474 | { | 2474 | { |
2475 | return snprintf(buf, PAGE_SIZE, "%llu\n", | 2475 | return snprintf(buf, PAGE_SIZE, "%llu\n", |
2476 | (s64) percpu_counter_sum(&sbi->s_dirtyblocks_counter)); | 2476 | (s64) percpu_counter_sum(&sbi->s_dirtyclusters_counter)); |
2477 | } | 2477 | } |
2478 | 2478 | ||
2479 | static ssize_t session_write_kbytes_show(struct ext4_attr *a, | 2479 | static ssize_t session_write_kbytes_show(struct ext4_attr *a, |
@@ -3575,7 +3575,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3575 | sbi->s_err_report.function = print_daily_error_info; | 3575 | sbi->s_err_report.function = print_daily_error_info; |
3576 | sbi->s_err_report.data = (unsigned long) sb; | 3576 | sbi->s_err_report.data = (unsigned long) sb; |
3577 | 3577 | ||
3578 | err = percpu_counter_init(&sbi->s_freeblocks_counter, | 3578 | err = percpu_counter_init(&sbi->s_freeclusters_counter, |
3579 | ext4_count_free_blocks(sb)); | 3579 | ext4_count_free_blocks(sb)); |
3580 | if (!err) { | 3580 | if (!err) { |
3581 | err = percpu_counter_init(&sbi->s_freeinodes_counter, | 3581 | err = percpu_counter_init(&sbi->s_freeinodes_counter, |
@@ -3586,7 +3586,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3586 | ext4_count_dirs(sb)); | 3586 | ext4_count_dirs(sb)); |
3587 | } | 3587 | } |
3588 | if (!err) { | 3588 | if (!err) { |
3589 | err = percpu_counter_init(&sbi->s_dirtyblocks_counter, 0); | 3589 | err = percpu_counter_init(&sbi->s_dirtyclusters_counter, 0); |
3590 | } | 3590 | } |
3591 | if (err) { | 3591 | if (err) { |
3592 | ext4_msg(sb, KERN_ERR, "insufficient memory"); | 3592 | ext4_msg(sb, KERN_ERR, "insufficient memory"); |
@@ -3701,13 +3701,13 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3701 | * The journal may have updated the bg summary counts, so we | 3701 | * The journal may have updated the bg summary counts, so we |
3702 | * need to update the global counters. | 3702 | * need to update the global counters. |
3703 | */ | 3703 | */ |
3704 | percpu_counter_set(&sbi->s_freeblocks_counter, | 3704 | percpu_counter_set(&sbi->s_freeclusters_counter, |
3705 | ext4_count_free_blocks(sb)); | 3705 | ext4_count_free_blocks(sb)); |
3706 | percpu_counter_set(&sbi->s_freeinodes_counter, | 3706 | percpu_counter_set(&sbi->s_freeinodes_counter, |
3707 | ext4_count_free_inodes(sb)); | 3707 | ext4_count_free_inodes(sb)); |
3708 | percpu_counter_set(&sbi->s_dirs_counter, | 3708 | percpu_counter_set(&sbi->s_dirs_counter, |
3709 | ext4_count_dirs(sb)); | 3709 | ext4_count_dirs(sb)); |
3710 | percpu_counter_set(&sbi->s_dirtyblocks_counter, 0); | 3710 | percpu_counter_set(&sbi->s_dirtyclusters_counter, 0); |
3711 | 3711 | ||
3712 | no_journal: | 3712 | no_journal: |
3713 | /* | 3713 | /* |
@@ -3847,10 +3847,10 @@ failed_mount3: | |||
3847 | del_timer(&sbi->s_err_report); | 3847 | del_timer(&sbi->s_err_report); |
3848 | if (sbi->s_flex_groups) | 3848 | if (sbi->s_flex_groups) |
3849 | ext4_kvfree(sbi->s_flex_groups); | 3849 | ext4_kvfree(sbi->s_flex_groups); |
3850 | percpu_counter_destroy(&sbi->s_freeblocks_counter); | 3850 | percpu_counter_destroy(&sbi->s_freeclusters_counter); |
3851 | percpu_counter_destroy(&sbi->s_freeinodes_counter); | 3851 | percpu_counter_destroy(&sbi->s_freeinodes_counter); |
3852 | percpu_counter_destroy(&sbi->s_dirs_counter); | 3852 | percpu_counter_destroy(&sbi->s_dirs_counter); |
3853 | percpu_counter_destroy(&sbi->s_dirtyblocks_counter); | 3853 | percpu_counter_destroy(&sbi->s_dirtyclusters_counter); |
3854 | if (sbi->s_mmp_tsk) | 3854 | if (sbi->s_mmp_tsk) |
3855 | kthread_stop(sbi->s_mmp_tsk); | 3855 | kthread_stop(sbi->s_mmp_tsk); |
3856 | failed_mount2: | 3856 | failed_mount2: |
@@ -4173,8 +4173,9 @@ static int ext4_commit_super(struct super_block *sb, int sync) | |||
4173 | else | 4173 | else |
4174 | es->s_kbytes_written = | 4174 | es->s_kbytes_written = |
4175 | cpu_to_le64(EXT4_SB(sb)->s_kbytes_written); | 4175 | cpu_to_le64(EXT4_SB(sb)->s_kbytes_written); |
4176 | ext4_free_blocks_count_set(es, percpu_counter_sum_positive( | 4176 | ext4_free_blocks_count_set(es, |
4177 | &EXT4_SB(sb)->s_freeblocks_counter)); | 4177 | EXT4_C2B(EXT4_SB(sb), percpu_counter_sum_positive( |
4178 | &EXT4_SB(sb)->s_freeclusters_counter))); | ||
4178 | es->s_free_inodes_count = | 4179 | es->s_free_inodes_count = |
4179 | cpu_to_le32(percpu_counter_sum_positive( | 4180 | cpu_to_le32(percpu_counter_sum_positive( |
4180 | &EXT4_SB(sb)->s_freeinodes_counter)); | 4181 | &EXT4_SB(sb)->s_freeinodes_counter)); |
@@ -4629,10 +4630,10 @@ static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
4629 | buf->f_type = EXT4_SUPER_MAGIC; | 4630 | buf->f_type = EXT4_SUPER_MAGIC; |
4630 | buf->f_bsize = sb->s_blocksize; | 4631 | buf->f_bsize = sb->s_blocksize; |
4631 | buf->f_blocks = ext4_blocks_count(es) - sbi->s_overhead_last; | 4632 | buf->f_blocks = ext4_blocks_count(es) - sbi->s_overhead_last; |
4632 | bfree = percpu_counter_sum_positive(&sbi->s_freeblocks_counter) - | 4633 | bfree = percpu_counter_sum_positive(&sbi->s_freeclusters_counter) - |
4633 | percpu_counter_sum_positive(&sbi->s_dirtyblocks_counter); | 4634 | percpu_counter_sum_positive(&sbi->s_dirtyclusters_counter); |
4634 | /* prevent underflow in case that few free space is available */ | 4635 | /* prevent underflow in case that few free space is available */ |
4635 | buf->f_bfree = max_t(s64, bfree, 0); | 4636 | buf->f_bfree = EXT4_C2B(sbi, max_t(s64, bfree, 0)); |
4636 | buf->f_bavail = buf->f_bfree - ext4_r_blocks_count(es); | 4637 | buf->f_bavail = buf->f_bfree - ext4_r_blocks_count(es); |
4637 | if (buf->f_bfree < ext4_r_blocks_count(es)) | 4638 | if (buf->f_bfree < ext4_r_blocks_count(es)) |
4638 | buf->f_bavail = 0; | 4639 | buf->f_bavail = 0; |