aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/super.c
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2008-10-10 09:39:00 -0400
committerTheodore Ts'o <tytso@mit.edu>2008-10-10 09:39:00 -0400
commit6bc6e63fcd7dac9e633ea29f1fddd9580ab28f3f (patch)
tree144d53023af5faeb94b9b3aa28e186a33e6c5b98 /fs/ext4/super.c
parent030ba6bc67b4f2bc5cd174f57785a1745c929abe (diff)
ext4: Add percpu dirty block accounting.
This patch adds dirty block accounting using percpu_counters. Delayed allocation block reservation is now done by updating dirty block counter. In a later patch we switch to non delalloc mode if the filesystem free blocks is greater than 150% of total filesystem dirty blocks Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Mingming Cao<cmm@us.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/super.c')
-rw-r--r--fs/ext4/super.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 7de6ca0c9e9b..efa40d9d3792 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -520,6 +520,7 @@ static void ext4_put_super(struct super_block *sb)
520 percpu_counter_destroy(&sbi->s_freeblocks_counter); 520 percpu_counter_destroy(&sbi->s_freeblocks_counter);
521 percpu_counter_destroy(&sbi->s_freeinodes_counter); 521 percpu_counter_destroy(&sbi->s_freeinodes_counter);
522 percpu_counter_destroy(&sbi->s_dirs_counter); 522 percpu_counter_destroy(&sbi->s_dirs_counter);
523 percpu_counter_destroy(&sbi->s_dirtyblocks_counter);
523 brelse(sbi->s_sbh); 524 brelse(sbi->s_sbh);
524#ifdef CONFIG_QUOTA 525#ifdef CONFIG_QUOTA
525 for (i = 0; i < MAXQUOTAS; i++) 526 for (i = 0; i < MAXQUOTAS; i++)
@@ -2259,6 +2260,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
2259 err = percpu_counter_init(&sbi->s_dirs_counter, 2260 err = percpu_counter_init(&sbi->s_dirs_counter,
2260 ext4_count_dirs(sb)); 2261 ext4_count_dirs(sb));
2261 } 2262 }
2263 if (!err) {
2264 err = percpu_counter_init(&sbi->s_dirtyblocks_counter, 0);
2265 }
2262 if (err) { 2266 if (err) {
2263 printk(KERN_ERR "EXT4-fs: insufficient memory\n"); 2267 printk(KERN_ERR "EXT4-fs: insufficient memory\n");
2264 goto failed_mount3; 2268 goto failed_mount3;
@@ -2491,6 +2495,7 @@ failed_mount3:
2491 percpu_counter_destroy(&sbi->s_freeblocks_counter); 2495 percpu_counter_destroy(&sbi->s_freeblocks_counter);
2492 percpu_counter_destroy(&sbi->s_freeinodes_counter); 2496 percpu_counter_destroy(&sbi->s_freeinodes_counter);
2493 percpu_counter_destroy(&sbi->s_dirs_counter); 2497 percpu_counter_destroy(&sbi->s_dirs_counter);
2498 percpu_counter_destroy(&sbi->s_dirtyblocks_counter);
2494failed_mount2: 2499failed_mount2:
2495 for (i = 0; i < db_count; i++) 2500 for (i = 0; i < db_count; i++)
2496 brelse(sbi->s_group_desc[i]); 2501 brelse(sbi->s_group_desc[i]);
@@ -3169,7 +3174,8 @@ static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf)
3169 buf->f_type = EXT4_SUPER_MAGIC; 3174 buf->f_type = EXT4_SUPER_MAGIC;
3170 buf->f_bsize = sb->s_blocksize; 3175 buf->f_bsize = sb->s_blocksize;
3171 buf->f_blocks = ext4_blocks_count(es) - sbi->s_overhead_last; 3176 buf->f_blocks = ext4_blocks_count(es) - sbi->s_overhead_last;
3172 buf->f_bfree = percpu_counter_sum_positive(&sbi->s_freeblocks_counter); 3177 buf->f_bfree = percpu_counter_sum_positive(&sbi->s_freeblocks_counter) -
3178 percpu_counter_sum_positive(&sbi->s_dirtyblocks_counter);
3173 ext4_free_blocks_count_set(es, buf->f_bfree); 3179 ext4_free_blocks_count_set(es, buf->f_bfree);
3174 buf->f_bavail = buf->f_bfree - ext4_r_blocks_count(es); 3180 buf->f_bavail = buf->f_bfree - ext4_r_blocks_count(es);
3175 if (buf->f_bfree < ext4_r_blocks_count(es)) 3181 if (buf->f_bfree < ext4_r_blocks_count(es))