From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton Subject: Re: [patch 4/6] brlock: introduce special brlocks Date: Mon, 19 Oct 2009 05:24:00 -0700 Message-ID: <20091019052400.e7f304aa.akpm@linux-foundation.org> References: <20091015044026.319860788@suse.de> <20091015050048.777261867@suse.de> <20091018222512.683973f7.akpm@linux-foundation.org> <20091019094909.GC27856@wotan.suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Al Viro , linux-fsdevel@vger.kernel.org, Ian Kent , Linus Torvalds , linux-kernel@vger.kernel.org To: Nick Piggin Return-path: Received: from smtp1.linux-foundation.org ([140.211.169.13]:36854 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754080AbZJSM00 (ORCPT ); Mon, 19 Oct 2009 08:26:26 -0400 In-Reply-To: <20091019094909.GC27856@wotan.suse.de> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Mon, 19 Oct 2009 11:49:09 +0200 Nick Piggin wrote: > On Sun, Oct 18, 2009 at 10:25:12PM -0700, Andrew Morton wrote: > > On Thu, 15 Oct 2009 15:40:30 +1100 npiggin@suse.de wrote: > > > > > +#define DECLARE_BRLOCK(name) \ > > > > This: > > > > > + DECLARE_PER_CPU(spinlock_t, name##_lock); \ > > > + static inline void name##_lock_init(void) { \ > > > + int i; \ > > > + for_each_possible_cpu(i) { \ > > > + spinlock_t *lock; \ > > > + lock = &per_cpu(name##_lock, i); \ > > > + spin_lock_init(lock); \ > > > + } \ > > > + } \ > > > + static inline void name##_rlock(void) { \ > > > + spinlock_t *lock; \ > > > + lock = &get_cpu_var(name##_lock); \ > > > + spin_lock(lock); \ > > > + } \ > > > > generates a definition, not a declaration. Hence DEFINE_BRLOCK. > > > > > > Well yes, but being a static inline, then I don't know of a better > way. Probably just better not to pretend we are expanding a simple > declaration here, and name it something differently? (BRLOCK_HEADER(blah))? DEFINE_BRLOCK(blah)