From 193ed1d6ba2a03d13713f093d2a489a529f1df25 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Wed, 27 Oct 2010 21:30:13 -0400 Subject: [PATCH] --- yaml --- r: 218891 b: refs/heads/master c: 7f93cff90fa9be6ed45f6189e136153d1d8631b0 h: refs/heads/master i: 218889: ee17f50f2a32228ded9db19fb85f05e15a0976c5 218887: 6566c1872d9e02cec3491470e33df6ff9c128485 v: v3 --- [refs] | 2 +- trunk/fs/ext4/super.c | 7 +++++-- trunk/include/linux/percpu_counter.h | 10 ++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index bc49b1b3e89e..b3cd5d162256 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 72f84e6560d18d60a091df27edf81409be6641cb +refs/heads/master: 7f93cff90fa9be6ed45f6189e136153d1d8631b0 diff --git a/trunk/fs/ext4/super.c b/trunk/fs/ext4/super.c index 9ce3b67b7269..c9e06c647ce8 100644 --- a/trunk/fs/ext4/super.c +++ b/trunk/fs/ext4/super.c @@ -3964,9 +3964,12 @@ static int ext4_commit_super(struct super_block *sb, int sync) else es->s_kbytes_written = cpu_to_le64(EXT4_SB(sb)->s_kbytes_written); - ext4_free_blocks_count_set(es, percpu_counter_sum_positive( + if (percpu_counter_initialized(&EXT4_SB(sb)->s_freeblocks_counter)) + ext4_free_blocks_count_set(es, percpu_counter_sum_positive( &EXT4_SB(sb)->s_freeblocks_counter)); - es->s_free_inodes_count = cpu_to_le32(percpu_counter_sum_positive( + if (percpu_counter_initialized(&EXT4_SB(sb)->s_freeinodes_counter)) + es->s_free_inodes_count = + cpu_to_le32(percpu_counter_sum_positive( &EXT4_SB(sb)->s_freeinodes_counter)); sb->s_dirt = 0; BUFFER_TRACE(sbh, "marking dirty"); diff --git a/trunk/include/linux/percpu_counter.h b/trunk/include/linux/percpu_counter.h index 8a7d510ffa9c..46f6ba56fa91 100644 --- a/trunk/include/linux/percpu_counter.h +++ b/trunk/include/linux/percpu_counter.h @@ -78,6 +78,11 @@ static inline s64 percpu_counter_read_positive(struct percpu_counter *fbc) return 1; } +static inline int percpu_counter_initialized(struct percpu_counter *fbc) +{ + return (fbc->counters != NULL); +} + #else struct percpu_counter { @@ -143,6 +148,11 @@ static inline s64 percpu_counter_sum(struct percpu_counter *fbc) return percpu_counter_read(fbc); } +static inline int percpu_counter_initialized(struct percpu_counter *fbc) +{ + return 1; +} + #endif /* CONFIG_SMP */ static inline void percpu_counter_inc(struct percpu_counter *fbc)