diff mbox

ext4: use percpu counter for extent cache count

Message ID 20130302152644.GA22941@thunk.org
State Accepted, archived
Headers show

Commit Message

Theodore Ts'o March 2, 2013, 3:26 p.m. UTC
On Fri, Mar 01, 2013 at 12:02:34PM -0600, Eric Sandeen wrote:
> 
> I was mostly keying off what quota felt was best, I guess.
> I'm not wedded to either approach, it was just a thought.
> So you can take it or leave it. :)

I'll take it, but for the record, there's a reason why I label patches
with "I haven't tested this yet" disclaimers.

For future reference, calling percpu_counter_init() and
percpu_counter_destroy() is not optional --- without them, in your
original patch, the kernel will crash them the first time an ext4 file
system mount is attempted.

No worries though, no harm done --- but it's better if people don't
rely on me to catch bugs before they go into the tree.  :-)

						- Ted

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Zheng Liu March 3, 2013, 4:39 p.m. UTC | #1
On Sat, Mar 02, 2013 at 10:26:44AM -0500, Theodore Ts'o wrote:
> On Fri, Mar 01, 2013 at 12:02:34PM -0600, Eric Sandeen wrote:
> > 
> > I was mostly keying off what quota felt was best, I guess.
> > I'm not wedded to either approach, it was just a thought.
> > So you can take it or leave it. :)
> 
> I'll take it, but for the record, there's a reason why I label patches
> with "I haven't tested this yet" disclaimers.
> 
> For future reference, calling percpu_counter_init() and
> percpu_counter_destroy() is not optional --- without them, in your
> original patch, the kernel will crash them the first time an ext4 file
> system mount is attempted.
> 
> No worries though, no harm done --- but it's better if people don't
> rely on me to catch bugs before they go into the tree.  :-)

Really sorry for the delay reply.

Dave, thank you very much for your test and reporting this regression.

Ted, Eric, thank you very much for fixing it.  

I really think I need to be responsible for reviewing and testing this
patch because I screw it up.  My apology.

Thanks,
                                                - Zheng
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Sandeen March 4, 2013, 4:11 p.m. UTC | #2
On 3/2/13 9:26 AM, Theodore Ts'o wrote:
> On Fri, Mar 01, 2013 at 12:02:34PM -0600, Eric Sandeen wrote:
>>
>> I was mostly keying off what quota felt was best, I guess.
>> I'm not wedded to either approach, it was just a thought.
>> So you can take it or leave it. :)
> 
> I'll take it, but for the record, there's a reason why I label patches
> with "I haven't tested this yet" disclaimers.
> 
> For future reference, calling percpu_counter_init() and
> percpu_counter_destroy() is not optional --- without them, in your
> original patch, the kernel will crash them the first time an ext4 file
> system mount is attempted.
> 
> No worries though, no harm done --- but it's better if people don't
> rely on me to catch bugs before they go into the tree.  :-)

Oh crud, I'm really sorry.  I originally had the patch embedded
in a reply, and it did say "not tested" and was more of a "what do
you think about this" - then I elevated it to its own mail in the
thread and I lost the disclaimer.  Entirely my fault.  :(

That's two stupid-patch-demerits for me from Friday.  Only one
one ext4.  ;)

-Eric

> 						- Ted
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 373d46c..1ae5860 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -783,6 +783,7 @@ static void ext4_put_super(struct super_block *sb)
>  	percpu_counter_destroy(&sbi->s_freeinodes_counter);
>  	percpu_counter_destroy(&sbi->s_dirs_counter);
>  	percpu_counter_destroy(&sbi->s_dirtyclusters_counter);
> +	percpu_counter_destroy(&sbi->s_extent_cache_cnt);
>  	brelse(sbi->s_sbh);
>  #ifdef CONFIG_QUOTA
>  	for (i = 0; i < MAXQUOTAS; i++)
> @@ -3688,6 +3689,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
>  	if (!err) {
>  		err = percpu_counter_init(&sbi->s_dirtyclusters_counter, 0);
>  	}
> +	if (!err) {
> +		err = percpu_counter_init(&sbi->s_extent_cache_cnt, 0);
> +	}
>  	if (err) {
>  		ext4_msg(sb, KERN_ERR, "insufficient memory");
>  		goto failed_mount3;
> @@ -3993,6 +3997,7 @@ failed_mount3:
>  	percpu_counter_destroy(&sbi->s_freeinodes_counter);
>  	percpu_counter_destroy(&sbi->s_dirs_counter);
>  	percpu_counter_destroy(&sbi->s_dirtyclusters_counter);
> +	percpu_counter_destroy(&sbi->s_extent_cache_cnt);
>  	if (sbi->s_mmp_tsk)
>  		kthread_stop(sbi->s_mmp_tsk);
>  failed_mount2:
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 373d46c..1ae5860 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -783,6 +783,7 @@  static void ext4_put_super(struct super_block *sb)
 	percpu_counter_destroy(&sbi->s_freeinodes_counter);
 	percpu_counter_destroy(&sbi->s_dirs_counter);
 	percpu_counter_destroy(&sbi->s_dirtyclusters_counter);
+	percpu_counter_destroy(&sbi->s_extent_cache_cnt);
 	brelse(sbi->s_sbh);
 #ifdef CONFIG_QUOTA
 	for (i = 0; i < MAXQUOTAS; i++)
@@ -3688,6 +3689,9 @@  static int ext4_fill_super(struct super_block *sb, void *data, int silent)
 	if (!err) {
 		err = percpu_counter_init(&sbi->s_dirtyclusters_counter, 0);
 	}
+	if (!err) {
+		err = percpu_counter_init(&sbi->s_extent_cache_cnt, 0);
+	}
 	if (err) {
 		ext4_msg(sb, KERN_ERR, "insufficient memory");
 		goto failed_mount3;
@@ -3993,6 +3997,7 @@  failed_mount3:
 	percpu_counter_destroy(&sbi->s_freeinodes_counter);
 	percpu_counter_destroy(&sbi->s_dirs_counter);
 	percpu_counter_destroy(&sbi->s_dirtyclusters_counter);
+	percpu_counter_destroy(&sbi->s_extent_cache_cnt);
 	if (sbi->s_mmp_tsk)
 		kthread_stop(sbi->s_mmp_tsk);
 failed_mount2: