From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kara Subject: Re: [PATCH] quota: Make quota stat accounting lockless. Date: Mon, 26 Apr 2010 19:37:30 +0200 Message-ID: <20100426173729.GG3673@quack.suse.cz> References: <87ljceka4i.fsf@openvz.org> <20100426151623.GD3673@quack.suse.cz> <20100426152407.GE3673@quack.suse.cz> <87r5m2chsv.fsf@openvz.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Jan Kara , linux-fsdevel@vger.kernel.org To: Dmitry Monakhov Return-path: Received: from cantor2.suse.de ([195.135.220.15]:53827 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753437Ab0DZRha (ORCPT ); Mon, 26 Apr 2010 13:37:30 -0400 Content-Disposition: inline In-Reply-To: <87r5m2chsv.fsf@openvz.org> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Mon 26-04-10 20:14:24, Dmitry Monakhov wrote: > Jan Kara writes: > > > On Mon 26-04-10 17:16:23, Jan Kara wrote: > >> On Fri 23-04-10 09:31:41, Dmitry Monakhov wrote: > >> > > >> > I've written this patch long time ago, it is pretty simple, and > >> > allow more non obvious locking optimization to be done later. > >> The patch looks OK to me. Will merge it. > > Hmm, maybe I spoke to soon. One question: > > > >> > +void dqstats_inc(unsigned int type) > >> > +{ > >> > +#ifdef CONFIG_SMP > >> > + per_cpu_ptr(dqstats_pcpu, smp_processor_id())->stat[type]++; > >> > +#else > >> > + dqstats[type]++; > >> > +#endif > >> > +} > >> > + > >> > +void dqstats_dec(unsigned int type) > >> > +{ > >> > +#ifdef CONFIG_SMP > >> > + per_cpu_ptr(dqstats_pcpu, smp_processor_id())->stat[type]--; > >> > +#else > >> > + dqstats[type]--; > >> > +#endif > >> > +} > > Why not make these two functions inline? Since they are used > > also from quota_tree.c and quota_v1.c, we'd need to move them to a > > quota.h header in that case. > My initial goal was to keep inc/dec/read helpers together. > We still need to export dqstats_pcpu. But if you prefer this style > i'm ok with it. New version attached. OK, I've merged the new version (with a few whitespace fixes). Thanks. Honza -- Jan Kara SUSE Labs, CR