From patchwork Sat Mar 2 15:26:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Theodore Ts'o X-Patchwork-Id: 224503 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 0F3692C0309 for ; Sun, 3 Mar 2013 02:26:58 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752029Ab3CBP0w (ORCPT ); Sat, 2 Mar 2013 10:26:52 -0500 Received: from li9-11.members.linode.com ([67.18.176.11]:50928 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750835Ab3CBP0v (ORCPT ); Sat, 2 Mar 2013 10:26:51 -0500 Received: from root (helo=closure.thunk.org) by imap.thunk.org with local-esmtp (Exim 4.80) (envelope-from ) id 1UBoKk-0000wy-1j; Sat, 02 Mar 2013 15:26:46 +0000 Received: by closure.thunk.org (Postfix, from userid 15806) id 876EB3E75E6; Sat, 2 Mar 2013 10:26:44 -0500 (EST) Date: Sat, 2 Mar 2013 10:26:44 -0500 From: Theodore Ts'o To: Eric Sandeen Cc: Dave Jones , "gnehzuil.liu" , Zheng Liu , "linux-ext4@vger.kernel.org" Subject: Re: [PATCH] ext4: use percpu counter for extent cache count Message-ID: <20130302152644.GA22941@thunk.org> References: <20130227185625.GA224@x4> <20130227191923.GA1121@redhat.com> <20130227192907.GB14253@thunk.org> <20130227201217.GD14253@thunk.org> <20130301033005.GA7081@redhat.com> <20130301040039.GA4452@thunk.org> <20130301050029.GB4452@thunk.org> <5130DA71.4040808@redhat.com> <20130301180035.GB17920@thunk.org> <5130ED3A.30003@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <5130ED3A.30003@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 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 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: