Re: [patch 1/2] kernel: introduce brlock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux