From: Andrew Morton <akpm@linux-foundation.org>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: linux-kernel@vger.kernel.org,
Alexander Viro <viro@zeniv.linux.org.uk>,
Rusty Russell <rusty@rustcorp.com.au>,
Andi Kleen <ak@linux.intel.com>,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 3/3] lglock: add DEFINE_STATIC_LGLOCK()
Date: Tue, 9 Oct 2012 14:48:42 -0700 [thread overview]
Message-ID: <20121009144842.a4f161c9.akpm@linux-foundation.org> (raw)
In-Reply-To: <1349754403-4798-3-git-send-email-laijs@cn.fujitsu.com>
On Tue, 9 Oct 2012 11:46:40 +0800
Lai Jiangshan <laijs@cn.fujitsu.com> wrote:
> When if the lglock don't to be exported,
> we can use DEFINE_STATIC_LGLOCK().
>
> --- a/include/linux/lglock.h
> +++ b/include/linux/lglock.h
> @@ -32,7 +32,8 @@
> #define br_write_lock(name) lg_global_lock(name)
> #define br_write_unlock(name) lg_global_unlock(name)
>
> -#define DEFINE_BRLOCK(name) DEFINE_LGLOCK(name)
> +#define DEFINE_BRLOCK(name) DEFINE_LGLOCK(name)
> +#define DEFINE_STATIC_BRLOCK(name) DEFINE_STATIC_LGLOCK(name)
>
> #ifdef CONFIG_DEBUG_LOCK_ALLOC
> #define LOCKDEP_INIT_MAP lockdep_init_map
> @@ -53,6 +54,11 @@ struct lglock {
> = __ARCH_SPIN_LOCK_UNLOCKED; \
> struct lglock name = { .lock = &name ## _lock }
>
> +#define DEFINE_STATIC_LGLOCK(name) \
> + static DEFINE_PER_CPU(arch_spinlock_t, name ## _lock) \
> + = __ARCH_SPIN_LOCK_UNLOCKED; \
> + static struct lglock name = { .lock = &name ## _lock }
> +
> void lg_lock_init(struct lglock *lg, char *name);
> void lg_local_lock(struct lglock *lg);
> void lg_local_unlock(struct lglock *lg);
hm, this is a bit sad. It would be better if we could do
static DEFINE_LGLOCK(foo);
but I don't immediately see a way in which we can rework
DEFINE_LGLOCK() to permit that.
prev parent reply other threads:[~2012-10-09 21:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-09 3:46 [PATCH 1/3] lglock: remove unused DEFINE_LGLOCK_LOCKDEP() Lai Jiangshan
2012-10-09 3:46 ` [PATCH 2/3] lglock: make the per_cpu locks static Lai Jiangshan
2012-10-09 21:46 ` Andrew Morton
2012-10-09 3:46 ` [PATCH 3/3] lglock: add DEFINE_STATIC_LGLOCK() Lai Jiangshan
2012-10-09 21:48 ` Andrew Morton [this message]
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=20121009144842.a4f161c9.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=ak@linux.intel.com \
--cc=laijs@cn.fujitsu.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--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
all inboxes | Powered by JetHome®