From: Nick Piggin <npiggin@suse.de>
To: Andreas Dilger <adilger@sun.com>
Cc: Al Viro <viro@ZenIV.linux.org.uk>,
Frank Mayhar <fmayhar@google.com>,
John Stultz <johnstul@us.ibm.com>,
Andi Kleen <ak@linux.intel.com>,
linux-fsdevel@vger.kernel.org
Subject: Re: [patch 1/2] kernel: introduce brlock
Date: Wed, 17 Mar 2010 10:44:40 +1100 [thread overview]
Message-ID: <20100316234440.GU2869@laptop> (raw)
In-Reply-To: <C5663A28-9BC3-4906-89E6-3A2BCE11ECB4@sun.com>
On Tue, Mar 16, 2010 at 01:01:09PM -0600, Andreas Dilger wrote:
> On 2010-03-16, at 06:22, Nick Piggin wrote:
> >+#define DEFINE_BRLOCK(name) \
> >+ DEFINE_PER_CPU(spinlock_t, name##_lock); \
> >+ void name##_lock_init(void) { \
> >+ void name##_wlock(void) { \
> >+ void name##_wunlock(void) { \
> >+ int name##_atomic_dec_and_wlock__failed(atomic_t *a) {
>
> What makes these macros unpleasant is that it is no longer possible
> to tag to the implementation to see what it does, since there is no
> real declaration for these locks.
>
> Is it possible to change the macros to take the lock name as a
> parameter, like normal lock/unlock functions do, and then have a
> single declaration for br_lock_init(), br_wlock(), etc. macros?
The problem is that then you can't do out of line functions, and
things like wlock/wunlock are rather large.
What I think I can do is add macros in the brlock.h file
#define br_rlock(name) ##name_rlock()
So the macro calls the right function and your tag should take
you pretty close to the right place.
Any better ideas how to implement this nicely would be welcome.
It must be as light-weight as possible in the rlock path though.
next prev parent reply other threads:[~2010-03-16 23:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-16 12:22 [patch 1/2] kernel: introduce brlock Nick Piggin
2010-03-16 12:23 ` [patch 2/2] fs: scale vfsmount_lock Nick Piggin
2010-03-16 12:28 ` Nick Piggin
2010-03-17 14:20 ` Nick Piggin
2010-03-17 20:33 ` Andreas Dilger
2010-03-16 19:01 ` [patch 1/2] kernel: introduce brlock Andreas Dilger
2010-03-16 20:12 ` Frank Mayhar
2010-03-16 23:44 ` Nick Piggin [this message]
2010-03-17 14:18 ` Nick Piggin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100316234440.GU2869@laptop \
--to=npiggin@suse.de \
--cc=adilger@sun.com \
--cc=ak@linux.intel.com \
--cc=fmayhar@google.com \
--cc=johnstul@us.ibm.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@ZenIV.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).