diff options
author | Theodore Ts'o <tytso@mit.edu> | 2013-03-02 10:27:46 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2013-03-02 10:27:46 -0500 |
commit | 1ac6466f253ef7bd063b7877fb056afe1820841c (patch) | |
tree | 8202e2ba849b72236ea186cfbfd4c4098aa7d699 /fs/ext4/super.c | |
parent | 246307745c406379996e6ed6411f0e20f1ce1449 (diff) |
ext4: use percpu counter for extent cache count
Use a percpu counter rather than atomic types for shrinker accounting.
There's no need for ultimate accuracy in the shrinker, so this
should come a little more cheaply. The percpu struct is somewhat
large, but there was a big gap before the cache-aligned
s_es_lru_lock anyway, and it fits nicely in there.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r-- | fs/ext4/super.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 373d46cd5d3f..1ae5860b30a3 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -783,6 +783,7 @@ static void ext4_put_super(struct super_block *sb) | |||
783 | percpu_counter_destroy(&sbi->s_freeinodes_counter); | 783 | percpu_counter_destroy(&sbi->s_freeinodes_counter); |
784 | percpu_counter_destroy(&sbi->s_dirs_counter); | 784 | percpu_counter_destroy(&sbi->s_dirs_counter); |
785 | percpu_counter_destroy(&sbi->s_dirtyclusters_counter); | 785 | percpu_counter_destroy(&sbi->s_dirtyclusters_counter); |
786 | percpu_counter_destroy(&sbi->s_extent_cache_cnt); | ||
786 | brelse(sbi->s_sbh); | 787 | brelse(sbi->s_sbh); |
787 | #ifdef CONFIG_QUOTA | 788 | #ifdef CONFIG_QUOTA |
788 | for (i = 0; i < MAXQUOTAS; i++) | 789 | for (i = 0; i < MAXQUOTAS; i++) |
@@ -3688,6 +3689,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) | |||
3688 | if (!err) { | 3689 | if (!err) { |
3689 | err = percpu_counter_init(&sbi->s_dirtyclusters_counter, 0); | 3690 | err = percpu_counter_init(&sbi->s_dirtyclusters_counter, 0); |
3690 | } | 3691 | } |
3692 | if (!err) { | ||
3693 | err = percpu_counter_init(&sbi->s_extent_cache_cnt, 0); | ||
3694 | } | ||
3691 | if (err) { | 3695 | if (err) { |
3692 | ext4_msg(sb, KERN_ERR, "insufficient memory"); | 3696 | ext4_msg(sb, KERN_ERR, "insufficient memory"); |
3693 | goto failed_mount3; | 3697 | goto failed_mount3; |
@@ -3993,6 +3997,7 @@ failed_mount3: | |||
3993 | percpu_counter_destroy(&sbi->s_freeinodes_counter); | 3997 | percpu_counter_destroy(&sbi->s_freeinodes_counter); |
3994 | percpu_counter_destroy(&sbi->s_dirs_counter); | 3998 | percpu_counter_destroy(&sbi->s_dirs_counter); |
3995 | percpu_counter_destroy(&sbi->s_dirtyclusters_counter); | 3999 | percpu_counter_destroy(&sbi->s_dirtyclusters_counter); |
4000 | percpu_counter_destroy(&sbi->s_extent_cache_cnt); | ||
3996 | if (sbi->s_mmp_tsk) | 4001 | if (sbi->s_mmp_tsk) |
3997 | kthread_stop(sbi->s_mmp_tsk); | 4002 | kthread_stop(sbi->s_mmp_tsk); |
3998 | failed_mount2: | 4003 | failed_mount2: |