public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH SERIES] untangle spinlock macros
@ 2007-09-11  5:05 Eric Sandeen
  2007-09-12  1:06 ` Lachlan McIlroy
  2007-09-12  1:51 ` Donald Douwsma
  0 siblings, 2 replies; 13+ messages in thread
From: Eric Sandeen @ 2007-09-11  5:05 UTC (permalink / raw)
  To: xfs-oss

I have a series of patches at
http://sandeen.net/xfs-patches/patches-spinlock-unobfuscate.tar.bz2

to get rid of the macros upon macros hiding xfs' use of spinlocks, via
for example AIL_LOCK->mutex_spinlock->spin_lock.  This also gets rid of
the unused "cookie" variables declared via SPLDECL(s) and other
open-coded unsigned long s; declarations.

patches in the tarball, broken out by lock as requested a while
ago by dgc:

unwrap_AIL_LOCK
unwrap_LOG_LOCK
unwrap_GRANT_LOCK
unwrap_XFS_DQ_PINUNLOCK
unwrap_pagb_lock
unwrap_xfs_dabuf_global_lock
unwrap_mru_lock
unwrap_XFS_SB_LOCK
no_kt_lock
cleanup_lock_goop

Patches have comments/descriptions/signed-off lines in them.

By the end of the series, spin.h is almost empty, only spin_lock_init /
spinlock_destroy are left, and could maybe even be pulled out.... wasn't
sure how far to go.  Since the kernel has a mutex_destroy, I wonder if
spinlocks will ever get similar treatment... anyway....

I can post them to the list individually if preferred... though it's
fairly mechanical and not terribly interesting...

Thanks,
-Eric

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH SERIES] untangle spinlock macros
  2007-09-11  5:05 [PATCH SERIES] untangle spinlock macros Eric Sandeen
@ 2007-09-12  1:06 ` Lachlan McIlroy
  2007-09-12  1:35   ` Eric Sandeen
  2007-09-12  1:51 ` Donald Douwsma
  1 sibling, 1 reply; 13+ messages in thread
From: Lachlan McIlroy @ 2007-09-12  1:06 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs-oss

They look good to me.  There's still a few unused variables left over
but nothing we can't fix up.

Eric Sandeen wrote:
> I have a series of patches at
> http://sandeen.net/xfs-patches/patches-spinlock-unobfuscate.tar.bz2
> 
> to get rid of the macros upon macros hiding xfs' use of spinlocks, via
> for example AIL_LOCK->mutex_spinlock->spin_lock.  This also gets rid of
> the unused "cookie" variables declared via SPLDECL(s) and other
> open-coded unsigned long s; declarations.
> 
> patches in the tarball, broken out by lock as requested a while
> ago by dgc:
> 
> unwrap_AIL_LOCK
> unwrap_LOG_LOCK
> unwrap_GRANT_LOCK
> unwrap_XFS_DQ_PINUNLOCK
> unwrap_pagb_lock
> unwrap_xfs_dabuf_global_lock
> unwrap_mru_lock
> unwrap_XFS_SB_LOCK
> no_kt_lock
> cleanup_lock_goop
> 
> Patches have comments/descriptions/signed-off lines in them.
> 
> By the end of the series, spin.h is almost empty, only spin_lock_init /
> spinlock_destroy are left, and could maybe even be pulled out.... wasn't
> sure how far to go.  Since the kernel has a mutex_destroy, I wonder if
> spinlocks will ever get similar treatment... anyway....
> 
> I can post them to the list individually if preferred... though it's
> fairly mechanical and not terribly interesting...
> 
> Thanks,
> -Eric
> 
> 
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH SERIES] untangle spinlock macros
  2007-09-12  1:06 ` Lachlan McIlroy
@ 2007-09-12  1:35   ` Eric Sandeen
  2007-09-12  5:50     ` Lachlan McIlroy
  0 siblings, 1 reply; 13+ messages in thread
From: Eric Sandeen @ 2007-09-12  1:35 UTC (permalink / raw)
  To: Lachlan McIlroy; +Cc: xfs-oss

Lachlan McIlroy wrote:
> They look good to me.  There's still a few unused variables left over
> but nothing we can't fix up.

Great - and, weird - I don't see them in my tree... maybe I missed a
quilt refresh, but I don't think so... odd.

-Eric

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH SERIES] untangle spinlock macros
  2007-09-11  5:05 [PATCH SERIES] untangle spinlock macros Eric Sandeen
  2007-09-12  1:06 ` Lachlan McIlroy
@ 2007-09-12  1:51 ` Donald Douwsma
  2007-09-12  1:55   ` Eric Sandeen
                     ` (2 more replies)
  1 sibling, 3 replies; 13+ messages in thread
From: Donald Douwsma @ 2007-09-12  1:51 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs-oss

Eric Sandeen wrote:
> I have a series of patches at
> http://sandeen.net/xfs-patches/patches-spinlock-unobfuscate.tar.bz2
> 
> to get rid of the macros upon macros hiding xfs' use of spinlocks, via
> for example AIL_LOCK->mutex_spinlock->spin_lock.  This also gets rid of
> the unused "cookie" variables declared via SPLDECL(s) and other
> open-coded unsigned long s; declarations.
> 

Hi Eric,

> unwrap_AIL_LOCK
Here you change the comment to use the descriptive name

- * We must not be holding the AIL_LOCK at this point. Calling incore() to
- * search the buffer cache can be a time consuming thing, and AIL_LOCK is a
+ * We must not be holding the AIL lock at this point. Calling incore() to
+ * search the buffer cache can be a time consuming thing, and AIL lock is a
   * spinlock.
   */

> unwrap_LOG_LOCK
> unwrap_GRANT_LOCK
> unwrap_XFS_DQ_PINUNLOCK
> unwrap_pagb_lock
> unwrap_xfs_dabuf_global_lock
> unwrap_mru_lock
> unwrap_XFS_SB_LOCK
But here you use the name of the lock variable.

         /*
-        * We actually don't have to acquire the SB_LOCK at all.
+        * We actually don't have to acquire the m_sb_lock at all.
          * This can only be called from mount, and that's single threaded. XXX
          */

> no_kt_lock
> cleanup_lock_goop
> 
> Patches have comments/descriptions/signed-off lines in them.
> 
> By the end of the series, spin.h is almost empty, only spin_lock_init /
> spinlock_destroy are left, and could maybe even be pulled out.... wasn't
> sure how far to go.  Since the kernel has a mutex_destroy, I wonder if
> spinlocks will ever get similar treatment... anyway....
So the only things left in spin.h are the spinlock headers and

  #define spinlock_init(lock, name)      spin_lock_init(lock)
  #define        spinlock_destroy(lock)

I cant se why we need these abstractions. Should we nuke the whole file and
add the spinlock headers elsewhere?

Don

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH SERIES] untangle spinlock macros
  2007-09-12  1:51 ` Donald Douwsma
@ 2007-09-12  1:55   ` Eric Sandeen
  2007-09-12  2:07   ` Eric Sandeen
  2007-09-13  3:04   ` Eric Sandeen
  2 siblings, 0 replies; 13+ messages in thread
From: Eric Sandeen @ 2007-09-12  1:55 UTC (permalink / raw)
  To: Donald Douwsma; +Cc: xfs-oss

Donald Douwsma wrote:


> Hi Eric,
> 
>> unwrap_AIL_LOCK
> Here you change the comment to use the descriptive name
> 
> - * We must not be holding the AIL_LOCK at this point. Calling incore() to
> - * search the buffer cache can be a time consuming thing, and AIL_LOCK is a
> + * We must not be holding the AIL lock at this point. Calling incore() to
> + * search the buffer cache can be a time consuming thing, and AIL lock is a
>    * spinlock.
>    */
> 
>> unwrap_LOG_LOCK
>> unwrap_GRANT_LOCK
>> unwrap_XFS_DQ_PINUNLOCK
>> unwrap_pagb_lock
>> unwrap_xfs_dabuf_global_lock
>> unwrap_mru_lock
>> unwrap_XFS_SB_LOCK
> But here you use the name of the lock variable.
> 
>          /*
> -        * We actually don't have to acquire the SB_LOCK at all.
> +        * We actually don't have to acquire the m_sb_lock at all.
>           * This can only be called from mount, and that's single threaded. XXX
>           */

Hm yup.  2 different evenings, oops.  ;-)  Have a preference?

>> no_kt_lock
>> cleanup_lock_goop
>>
>> Patches have comments/descriptions/signed-off lines in them.
>>
>> By the end of the series, spin.h is almost empty, only spin_lock_init /
>> spinlock_destroy are left, and could maybe even be pulled out.... wasn't
>> sure how far to go.  Since the kernel has a mutex_destroy, I wonder if
>> spinlocks will ever get similar treatment... anyway....
> So the only things left in spin.h are the spinlock headers and
> 
>   #define spinlock_init(lock, name)      spin_lock_init(lock)
>   #define        spinlock_destroy(lock)
> 
> I cant se why we need these abstractions. Should we nuke the whole file and
> add the spinlock headers elsewhere?

We don't, really.  It'd be easy to nuke the file and add them to
xfs_linux.h.

I'll send a patch to do so if you like.

-Eric

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH SERIES] untangle spinlock macros
  2007-09-12  1:51 ` Donald Douwsma
  2007-09-12  1:55   ` Eric Sandeen
@ 2007-09-12  2:07   ` Eric Sandeen
  2007-09-12  6:04     ` Lachlan McIlroy
  2007-09-13  3:04   ` Eric Sandeen
  2 siblings, 1 reply; 13+ messages in thread
From: Eric Sandeen @ 2007-09-12  2:07 UTC (permalink / raw)
  To: Donald Douwsma; +Cc: xfs-oss

Donald Douwsma wrote:

>   
> So the only things left in spin.h are the spinlock headers and
>
>   #define spinlock_init(lock, name)      spin_lock_init(lock)
>   #define        spinlock_destroy(lock)
>
> I cant se why we need these abstractions. Should we nuke the whole file and
> add the spinlock headers elsewhere?
>
> Don
>
>   
Ok, if you want it :)

-------------------------

remove abstraction macros in spin.h, remove the callers, and 
remove the file.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>

Index: linux-2.6-xfs/fs/xfs/linux-2.6/spin.h
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/linux-2.6/spin.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-#ifndef __XFS_SUPPORT_SPIN_H__
-#define __XFS_SUPPORT_SPIN_H__
-
-#include <linux/sched.h>	/* preempt needs this */
-#include <linux/spinlock.h>
-
-#define spinlock_init(lock, name)	spin_lock_init(lock)
-#define	spinlock_destroy(lock)
-
-#endif /* __XFS_SUPPORT_SPIN_H__ */
Index: linux-2.6-xfs/fs/xfs/linux-2.6/xfs_buf.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/linux-2.6/xfs_buf.c
+++ linux-2.6-xfs/fs/xfs/linux-2.6/xfs_buf.c
@@ -1568,7 +1568,7 @@ xfs_alloc_delwrite_queue(
 
 	INIT_LIST_HEAD(&btp->bt_list);
 	INIT_LIST_HEAD(&btp->bt_delwrite_queue);
-	spinlock_init(&btp->bt_delwrite_lock, "delwri_lock");
+	spin_lock_init(&btp->bt_delwrite_lock);
 	btp->bt_flags = 0;
 	btp->bt_task = kthread_run(xfsbufd, btp, "xfsbufd");
 	if (IS_ERR(btp->bt_task)) {
Index: linux-2.6-xfs/fs/xfs/linux-2.6/xfs_linux.h
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/linux-2.6/xfs_linux.h
+++ linux-2.6-xfs/fs/xfs/linux-2.6/xfs_linux.h
@@ -43,7 +43,6 @@
 
 #include <kmem.h>
 #include <mrlock.h>
-#include <spin.h>
 #include <sv.h>
 #include <mutex.h>
 #include <sema.h>
@@ -75,6 +74,7 @@
 #include <linux/notifier.h>
 #include <linux/delay.h>
 #include <linux/log2.h>
+#include <linux/spinlock.h>
 
 #include <asm/page.h>
 #include <asm/div64.h>
Index: linux-2.6-xfs/fs/xfs/quota/xfs_qm.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/quota/xfs_qm.c
+++ linux-2.6-xfs/fs/xfs/quota/xfs_qm.c
@@ -1131,7 +1131,7 @@ xfs_qm_init_quotainfo(
 		return error;
 	}
 
-	spinlock_init(&qinf->qi_pinlock, "xfs_qinf_pin");
+	spin_lock_init(&qinf->qi_pinlock);
 	xfs_qm_list_init(&qinf->qi_dqlist, "mpdqlist", 0);
 	qinf->qi_dqreclaims = 0;
 
@@ -1228,7 +1228,6 @@ xfs_qm_destroy_quotainfo(
 	 */
 	xfs_qm_rele_quotafs_ref(mp);
 
-	spinlock_destroy(&qi->qi_pinlock);
 	xfs_qm_list_destroy(&qi->qi_dqlist);
 
 	if (qi->qi_uquotaip) {
Index: linux-2.6-xfs/fs/xfs/support/debug.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/support/debug.c
+++ linux-2.6-xfs/fs/xfs/support/debug.c
@@ -17,7 +17,6 @@
  */
 #include <xfs.h>
 #include "debug.h"
-#include "spin.h"
 
 static char		message[1024];	/* keep it off the stack */
 static DEFINE_SPINLOCK(xfs_err_lock);
Index: linux-2.6-xfs/fs/xfs/support/ktrace.h
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/support/ktrace.h
+++ linux-2.6-xfs/fs/xfs/support/ktrace.h
@@ -18,8 +18,6 @@
 #ifndef __XFS_SUPPORT_KTRACE_H__
 #define __XFS_SUPPORT_KTRACE_H__
 
-#include <spin.h>
-
 /*
  * Trace buffer entry structure.
  */
Index: linux-2.6-xfs/fs/xfs/xfs_alloc.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/xfs_alloc.c
+++ linux-2.6-xfs/fs/xfs/xfs_alloc.c
@@ -2206,7 +2206,7 @@ xfs_alloc_read_agf(
 			be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNOi]);
 		pag->pagf_levels[XFS_BTNUM_CNTi] =
 			be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNTi]);
-		spinlock_init(&pag->pagb_lock, "xfspagb");
+		spin_lock_init(&pag->pagb_lock);
 		pag->pagb_list = kmem_zalloc(XFS_PAGB_NUM_SLOTS *
 					sizeof(xfs_perag_busy_t), KM_SLEEP);
 		pag->pagf_init = 1;
Index: linux-2.6-xfs/fs/xfs/xfs_log.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/xfs_log.c
+++ linux-2.6-xfs/fs/xfs/xfs_log.c
@@ -1189,8 +1189,8 @@ xlog_alloc_log(xfs_mount_t	*mp,
 	ASSERT(XFS_BUF_VALUSEMA(bp) <= 0);
 	log->l_xbuf = bp;
 
-	spinlock_init(&log->l_icloglock, "iclog");
-	spinlock_init(&log->l_grant_lock, "grhead_iclog");
+	spin_lock_init(&log->l_icloglock);
+	spin_lock_init(&log->l_grant_lock);
 	initnsema(&log->l_flushsema, 0, "ic-flush");
 	xlog_state_ticket_alloc(log);  /* wait until after icloglock inited */
 
@@ -1543,8 +1543,6 @@ xlog_dealloc_log(xlog_t *log)
 		iclog = next_iclog;
 	}
 	freesema(&log->l_flushsema);
-	spinlock_destroy(&log->l_icloglock);
-	spinlock_destroy(&log->l_grant_lock);
 
 	/* XXXsup take a look at this again. */
 	if ((log->l_ticket_cnt != log->l_ticket_tcnt)  &&
Index: linux-2.6-xfs/fs/xfs/xfs_mount.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/xfs_mount.c
+++ linux-2.6-xfs/fs/xfs/xfs_mount.c
@@ -136,8 +136,8 @@ xfs_mount_init(void)
 		mp->m_flags |= XFS_MOUNT_NO_PERCPU_SB;
 	}
 
-	spinlock_init(&mp->m_ail_lock, "xfs_ail");
-	spinlock_init(&mp->m_sb_lock, "xfs_sb");
+	spin_lock_init(&mp->m_ail_lock);
+	spin_lock_init(&mp->m_sb_lock);
 	mutex_init(&mp->m_ilock);
 	mutex_init(&mp->m_growlock);
 	/*
@@ -171,8 +171,6 @@ xfs_mount_free(
 			  sizeof(xfs_perag_t) * mp->m_sb.sb_agcount);
 	}
 
-	spinlock_destroy(&mp->m_ail_lock);
-	spinlock_destroy(&mp->m_sb_lock);
 	mutex_destroy(&mp->m_ilock);
 	mutex_destroy(&mp->m_growlock);
 	if (mp->m_quotainfo)
@@ -616,7 +614,7 @@ xfs_mount_common(xfs_mount_t *mp, xfs_sb
 	int	i;
 
 	mp->m_agfrotor = mp->m_agirotor = 0;
-	spinlock_init(&mp->m_agirotor_lock, "m_agirotor_lock");
+	spin_lock_init(&mp->m_agirotor_lock);
 	mp->m_maxagi = mp->m_sb.sb_agcount;
 	mp->m_blkbit_log = sbp->sb_blocklog + XFS_NBBYLOG;
 	mp->m_blkbb_log = sbp->sb_blocklog - BBSHIFT;
Index: linux-2.6-xfs/fs/xfs/xfs_mru_cache.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/xfs_mru_cache.c
+++ linux-2.6-xfs/fs/xfs/xfs_mru_cache.c
@@ -368,7 +368,7 @@ xfs_mru_cache_create(
 	 */
 	INIT_RADIX_TREE(&mru->store, GFP_ATOMIC);
 	INIT_LIST_HEAD(&mru->reap_list);
-	spinlock_init(&mru->lock, "xfs_mru_cache");
+	spin_lock_init(&mru->lock);
 	INIT_DELAYED_WORK(&mru->work, _xfs_mru_cache_reap);
 
 	mru->grp_time  = grp_time;
Index: linux-2.6-xfs/fs/xfs/xfs_vfsops.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/xfs_vfsops.c
+++ linux-2.6-xfs/fs/xfs/xfs_vfsops.c
@@ -68,7 +68,7 @@ xfs_init(void)
 	extern kmem_zone_t	*xfs_dabuf_zone;
 #ifdef XFS_DABUF_DEBUG
 	extern spinlock_t        xfs_dabuf_global_lock;
-	spinlock_init(&xfs_dabuf_global_lock, "xfsda");
+	spin_lock_init(&xfs_dabuf_global_lock);
 #endif
 
 	/*

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH SERIES] untangle spinlock macros
  2007-09-12  1:35   ` Eric Sandeen
@ 2007-09-12  5:50     ` Lachlan McIlroy
  2007-09-12 14:32       ` Eric Sandeen
  0 siblings, 1 reply; 13+ messages in thread
From: Lachlan McIlroy @ 2007-09-12  5:50 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs-oss

Just these ones... not a problem.

fs/xfs/xfs_mount.c: In function ‘xfs_icsb_cpu_notify’:
fs/xfs/xfs_mount.c:1920: warning: unused variable ‘s’
fs/xfs/xfs_mount.c: In function ‘xfs_icsb_sync_counters_flags’:
fs/xfs/xfs_mount.c:2191: warning: unused variable ‘s’
fs/xfs/xfs_mount.c: In function ‘xfs_icsb_balance_counter’:
fs/xfs/xfs_mount.c:2249: warning: unused variable ‘s’
fs/xfs/xfs_mount.c: In function ‘xfs_icsb_modify_counters’:
fs/xfs/xfs_mount.c:2299: warning: unused variable ‘s’

Eric Sandeen wrote:
> Lachlan McIlroy wrote:
>> They look good to me.  There's still a few unused variables left over
>> but nothing we can't fix up.
> 
> Great - and, weird - I don't see them in my tree... maybe I missed a
> quilt refresh, but I don't think so... odd.
> 
> -Eric
> 
> 
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH SERIES] untangle spinlock macros
  2007-09-12  2:07   ` Eric Sandeen
@ 2007-09-12  6:04     ` Lachlan McIlroy
  2007-09-12  8:29       ` Christoph Hellwig
  0 siblings, 1 reply; 13+ messages in thread
From: Lachlan McIlroy @ 2007-09-12  6:04 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Donald Douwsma, xfs-oss

These changes look good Eric.

I'm in two minds about losing the spinlock_destroy() macros though.  If Linux
ever implements a spinlock teardown routine it would be nice to still have all
the placeholders still there.  Although I can't imagine it would do any more
than assert that the lock is not currently held.  If someone else wants to lose
the macros then I'm not going to argue.

Eric Sandeen wrote:
> Donald Douwsma wrote:
> 
>>   
>> So the only things left in spin.h are the spinlock headers and
>>
>>   #define spinlock_init(lock, name)      spin_lock_init(lock)
>>   #define        spinlock_destroy(lock)
>>
>> I cant se why we need these abstractions. Should we nuke the whole file and
>> add the spinlock headers elsewhere?
>>
>> Don
>>
>>   
> Ok, if you want it :)
> 
> -------------------------
> 
> remove abstraction macros in spin.h, remove the callers, and 
> remove the file.
> 
> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
> 
> Index: linux-2.6-xfs/fs/xfs/linux-2.6/spin.h
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/linux-2.6/spin.h
> +++ /dev/null
> @@ -1,27 +0,0 @@
> -/*
> - * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
> - * All Rights Reserved.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License as
> - * published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it would be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write the Free Software Foundation,
> - * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> - */
> -#ifndef __XFS_SUPPORT_SPIN_H__
> -#define __XFS_SUPPORT_SPIN_H__
> -
> -#include <linux/sched.h>	/* preempt needs this */
> -#include <linux/spinlock.h>
> -
> -#define spinlock_init(lock, name)	spin_lock_init(lock)
> -#define	spinlock_destroy(lock)
> -
> -#endif /* __XFS_SUPPORT_SPIN_H__ */
> Index: linux-2.6-xfs/fs/xfs/linux-2.6/xfs_buf.c
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/linux-2.6/xfs_buf.c
> +++ linux-2.6-xfs/fs/xfs/linux-2.6/xfs_buf.c
> @@ -1568,7 +1568,7 @@ xfs_alloc_delwrite_queue(
>  
>  	INIT_LIST_HEAD(&btp->bt_list);
>  	INIT_LIST_HEAD(&btp->bt_delwrite_queue);
> -	spinlock_init(&btp->bt_delwrite_lock, "delwri_lock");
> +	spin_lock_init(&btp->bt_delwrite_lock);
>  	btp->bt_flags = 0;
>  	btp->bt_task = kthread_run(xfsbufd, btp, "xfsbufd");
>  	if (IS_ERR(btp->bt_task)) {
> Index: linux-2.6-xfs/fs/xfs/linux-2.6/xfs_linux.h
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/linux-2.6/xfs_linux.h
> +++ linux-2.6-xfs/fs/xfs/linux-2.6/xfs_linux.h
> @@ -43,7 +43,6 @@
>  
>  #include <kmem.h>
>  #include <mrlock.h>
> -#include <spin.h>
>  #include <sv.h>
>  #include <mutex.h>
>  #include <sema.h>
> @@ -75,6 +74,7 @@
>  #include <linux/notifier.h>
>  #include <linux/delay.h>
>  #include <linux/log2.h>
> +#include <linux/spinlock.h>
>  
>  #include <asm/page.h>
>  #include <asm/div64.h>
> Index: linux-2.6-xfs/fs/xfs/quota/xfs_qm.c
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/quota/xfs_qm.c
> +++ linux-2.6-xfs/fs/xfs/quota/xfs_qm.c
> @@ -1131,7 +1131,7 @@ xfs_qm_init_quotainfo(
>  		return error;
>  	}
>  
> -	spinlock_init(&qinf->qi_pinlock, "xfs_qinf_pin");
> +	spin_lock_init(&qinf->qi_pinlock);
>  	xfs_qm_list_init(&qinf->qi_dqlist, "mpdqlist", 0);
>  	qinf->qi_dqreclaims = 0;
>  
> @@ -1228,7 +1228,6 @@ xfs_qm_destroy_quotainfo(
>  	 */
>  	xfs_qm_rele_quotafs_ref(mp);
>  
> -	spinlock_destroy(&qi->qi_pinlock);
>  	xfs_qm_list_destroy(&qi->qi_dqlist);
>  
>  	if (qi->qi_uquotaip) {
> Index: linux-2.6-xfs/fs/xfs/support/debug.c
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/support/debug.c
> +++ linux-2.6-xfs/fs/xfs/support/debug.c
> @@ -17,7 +17,6 @@
>   */
>  #include <xfs.h>
>  #include "debug.h"
> -#include "spin.h"
>  
>  static char		message[1024];	/* keep it off the stack */
>  static DEFINE_SPINLOCK(xfs_err_lock);
> Index: linux-2.6-xfs/fs/xfs/support/ktrace.h
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/support/ktrace.h
> +++ linux-2.6-xfs/fs/xfs/support/ktrace.h
> @@ -18,8 +18,6 @@
>  #ifndef __XFS_SUPPORT_KTRACE_H__
>  #define __XFS_SUPPORT_KTRACE_H__
>  
> -#include <spin.h>
> -
>  /*
>   * Trace buffer entry structure.
>   */
> Index: linux-2.6-xfs/fs/xfs/xfs_alloc.c
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/xfs_alloc.c
> +++ linux-2.6-xfs/fs/xfs/xfs_alloc.c
> @@ -2206,7 +2206,7 @@ xfs_alloc_read_agf(
>  			be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNOi]);
>  		pag->pagf_levels[XFS_BTNUM_CNTi] =
>  			be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNTi]);
> -		spinlock_init(&pag->pagb_lock, "xfspagb");
> +		spin_lock_init(&pag->pagb_lock);
>  		pag->pagb_list = kmem_zalloc(XFS_PAGB_NUM_SLOTS *
>  					sizeof(xfs_perag_busy_t), KM_SLEEP);
>  		pag->pagf_init = 1;
> Index: linux-2.6-xfs/fs/xfs/xfs_log.c
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/xfs_log.c
> +++ linux-2.6-xfs/fs/xfs/xfs_log.c
> @@ -1189,8 +1189,8 @@ xlog_alloc_log(xfs_mount_t	*mp,
>  	ASSERT(XFS_BUF_VALUSEMA(bp) <= 0);
>  	log->l_xbuf = bp;
>  
> -	spinlock_init(&log->l_icloglock, "iclog");
> -	spinlock_init(&log->l_grant_lock, "grhead_iclog");
> +	spin_lock_init(&log->l_icloglock);
> +	spin_lock_init(&log->l_grant_lock);
>  	initnsema(&log->l_flushsema, 0, "ic-flush");
>  	xlog_state_ticket_alloc(log);  /* wait until after icloglock inited */
>  
> @@ -1543,8 +1543,6 @@ xlog_dealloc_log(xlog_t *log)
>  		iclog = next_iclog;
>  	}
>  	freesema(&log->l_flushsema);
> -	spinlock_destroy(&log->l_icloglock);
> -	spinlock_destroy(&log->l_grant_lock);
>  
>  	/* XXXsup take a look at this again. */
>  	if ((log->l_ticket_cnt != log->l_ticket_tcnt)  &&
> Index: linux-2.6-xfs/fs/xfs/xfs_mount.c
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/xfs_mount.c
> +++ linux-2.6-xfs/fs/xfs/xfs_mount.c
> @@ -136,8 +136,8 @@ xfs_mount_init(void)
>  		mp->m_flags |= XFS_MOUNT_NO_PERCPU_SB;
>  	}
>  
> -	spinlock_init(&mp->m_ail_lock, "xfs_ail");
> -	spinlock_init(&mp->m_sb_lock, "xfs_sb");
> +	spin_lock_init(&mp->m_ail_lock);
> +	spin_lock_init(&mp->m_sb_lock);
>  	mutex_init(&mp->m_ilock);
>  	mutex_init(&mp->m_growlock);
>  	/*
> @@ -171,8 +171,6 @@ xfs_mount_free(
>  			  sizeof(xfs_perag_t) * mp->m_sb.sb_agcount);
>  	}
>  
> -	spinlock_destroy(&mp->m_ail_lock);
> -	spinlock_destroy(&mp->m_sb_lock);
>  	mutex_destroy(&mp->m_ilock);
>  	mutex_destroy(&mp->m_growlock);
>  	if (mp->m_quotainfo)
> @@ -616,7 +614,7 @@ xfs_mount_common(xfs_mount_t *mp, xfs_sb
>  	int	i;
>  
>  	mp->m_agfrotor = mp->m_agirotor = 0;
> -	spinlock_init(&mp->m_agirotor_lock, "m_agirotor_lock");
> +	spin_lock_init(&mp->m_agirotor_lock);
>  	mp->m_maxagi = mp->m_sb.sb_agcount;
>  	mp->m_blkbit_log = sbp->sb_blocklog + XFS_NBBYLOG;
>  	mp->m_blkbb_log = sbp->sb_blocklog - BBSHIFT;
> Index: linux-2.6-xfs/fs/xfs/xfs_mru_cache.c
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/xfs_mru_cache.c
> +++ linux-2.6-xfs/fs/xfs/xfs_mru_cache.c
> @@ -368,7 +368,7 @@ xfs_mru_cache_create(
>  	 */
>  	INIT_RADIX_TREE(&mru->store, GFP_ATOMIC);
>  	INIT_LIST_HEAD(&mru->reap_list);
> -	spinlock_init(&mru->lock, "xfs_mru_cache");
> +	spin_lock_init(&mru->lock);
>  	INIT_DELAYED_WORK(&mru->work, _xfs_mru_cache_reap);
>  
>  	mru->grp_time  = grp_time;
> Index: linux-2.6-xfs/fs/xfs/xfs_vfsops.c
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/xfs_vfsops.c
> +++ linux-2.6-xfs/fs/xfs/xfs_vfsops.c
> @@ -68,7 +68,7 @@ xfs_init(void)
>  	extern kmem_zone_t	*xfs_dabuf_zone;
>  #ifdef XFS_DABUF_DEBUG
>  	extern spinlock_t        xfs_dabuf_global_lock;
> -	spinlock_init(&xfs_dabuf_global_lock, "xfsda");
> +	spin_lock_init(&xfs_dabuf_global_lock);
>  #endif
>  
>  	/*
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH SERIES] untangle spinlock macros
  2007-09-12  6:04     ` Lachlan McIlroy
@ 2007-09-12  8:29       ` Christoph Hellwig
  2007-09-13  3:02         ` Eric Sandeen
  0 siblings, 1 reply; 13+ messages in thread
From: Christoph Hellwig @ 2007-09-12  8:29 UTC (permalink / raw)
  To: Lachlan McIlroy; +Cc: Eric Sandeen, Donald Douwsma, xfs-oss

On Wed, Sep 12, 2007 at 04:04:53PM +1000, Lachlan McIlroy wrote:
> These changes look good Eric.
> 
> I'm in two minds about losing the spinlock_destroy() macros though.  If 
> Linux
> ever implements a spinlock teardown routine it would be nice to still have 
> all
> the placeholders still there.  Although I can't imagine it would do any more
> than assert that the lock is not currently held.  If someone else wants to 
> lose
> the macros then I'm not going to argue.

I'd say keep them for now.  We don't need the spin.h header for them anyway,
as single macro can simply move to xfs_linux.h

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH SERIES] untangle spinlock macros
  2007-09-12  5:50     ` Lachlan McIlroy
@ 2007-09-12 14:32       ` Eric Sandeen
  0 siblings, 0 replies; 13+ messages in thread
From: Eric Sandeen @ 2007-09-12 14:32 UTC (permalink / raw)
  To: Lachlan McIlroy; +Cc: xfs-oss

Lachlan McIlroy wrote:
> Just these ones... not a problem.
> 
> fs/xfs/xfs_mount.c: In function ‘xfs_icsb_cpu_notify’:
> fs/xfs/xfs_mount.c:1920: warning: unused variable ‘s’
> fs/xfs/xfs_mount.c: In function ‘xfs_icsb_sync_counters_flags’:
> fs/xfs/xfs_mount.c:2191: warning: unused variable ‘s’
> fs/xfs/xfs_mount.c: In function ‘xfs_icsb_balance_counter’:
> fs/xfs/xfs_mount.c:2249: warning: unused variable ‘s’
> fs/xfs/xfs_mount.c: In function ‘xfs_icsb_modify_counters’:
> fs/xfs/xfs_mount.c:2299: warning: unused variable ‘s’

Ah, I didn't build with CONFIG_HOTPLUG_CPU, whoops!

Ok, I'll let you tidy that up ;-) and add it to my default config I guess!

-Eric

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH SERIES] untangle spinlock macros
  2007-09-12  8:29       ` Christoph Hellwig
@ 2007-09-13  3:02         ` Eric Sandeen
  2007-09-21 21:04           ` Russell Cattelan
  0 siblings, 1 reply; 13+ messages in thread
From: Eric Sandeen @ 2007-09-13  3:02 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Lachlan McIlroy, Donald Douwsma, xfs-oss

Christoph Hellwig wrote:
> On Wed, Sep 12, 2007 at 04:04:53PM +1000, Lachlan McIlroy wrote:
>   
>> These changes look good Eric.
>>
>> I'm in two minds about losing the spinlock_destroy() macros though.  If 
>> Linux
>> ever implements a spinlock teardown routine it would be nice to still have 
>> all
>> the placeholders still there.  Although I can't imagine it would do any more
>> than assert that the lock is not currently held.  If someone else wants to 
>> lose
>> the macros then I'm not going to argue.
>>     
>
> I'd say keep them for now.  We don't need the spin.h header for them anyway,
> as single macro can simply move to xfs_linux.h
>
>
>   
Try this on for size.....

======================

remove spinlock init abstraction macro in spin.h, remove the callers, 
and  remove the file.  Move no-op spinlock_destroy to xfs_linux.h

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>

Index: linux-2.6-xfs/fs/xfs/linux-2.6/spin.h
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/linux-2.6/spin.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write the Free Software Foundation,
- * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-#ifndef __XFS_SUPPORT_SPIN_H__
-#define __XFS_SUPPORT_SPIN_H__
-
-#include <linux/sched.h>	/* preempt needs this */
-#include <linux/spinlock.h>
-
-#define spinlock_init(lock, name)	spin_lock_init(lock)
-#define	spinlock_destroy(lock)
-
-#endif /* __XFS_SUPPORT_SPIN_H__ */
Index: linux-2.6-xfs/fs/xfs/linux-2.6/xfs_buf.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/linux-2.6/xfs_buf.c
+++ linux-2.6-xfs/fs/xfs/linux-2.6/xfs_buf.c
@@ -1568,7 +1568,7 @@ xfs_alloc_delwrite_queue(
 
 	INIT_LIST_HEAD(&btp->bt_list);
 	INIT_LIST_HEAD(&btp->bt_delwrite_queue);
-	spinlock_init(&btp->bt_delwrite_lock, "delwri_lock");
+	spin_lock_init(&btp->bt_delwrite_lock);
 	btp->bt_flags = 0;
 	btp->bt_task = kthread_run(xfsbufd, btp, "xfsbufd");
 	if (IS_ERR(btp->bt_task)) {
Index: linux-2.6-xfs/fs/xfs/linux-2.6/xfs_linux.h
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/linux-2.6/xfs_linux.h
+++ linux-2.6-xfs/fs/xfs/linux-2.6/xfs_linux.h
@@ -43,7 +43,6 @@
 
 #include <kmem.h>
 #include <mrlock.h>
-#include <spin.h>
 #include <sv.h>
 #include <mutex.h>
 #include <sema.h>
@@ -75,6 +74,7 @@
 #include <linux/notifier.h>
 #include <linux/delay.h>
 #include <linux/log2.h>
+#include <linux/spinlock.h>
 
 #include <asm/page.h>
 #include <asm/div64.h>
@@ -145,6 +145,8 @@
 #define current_restore_flags_nested(sp, f)	\
 		(current->flags = ((current->flags & ~(f)) | (*(sp) & (f))))
 
+#define spinlock_destroy(lock)
+
 #define NBPP		PAGE_SIZE
 #define NDPP		(1 << (PAGE_SHIFT - 9))
 
Index: linux-2.6-xfs/fs/xfs/quota/xfs_qm.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/quota/xfs_qm.c
+++ linux-2.6-xfs/fs/xfs/quota/xfs_qm.c
@@ -1131,7 +1131,7 @@ xfs_qm_init_quotainfo(
 		return error;
 	}
 
-	spinlock_init(&qinf->qi_pinlock, "xfs_qinf_pin");
+	spin_lock_init(&qinf->qi_pinlock);
 	xfs_qm_list_init(&qinf->qi_dqlist, "mpdqlist", 0);
 	qinf->qi_dqreclaims = 0;
 
Index: linux-2.6-xfs/fs/xfs/support/debug.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/support/debug.c
+++ linux-2.6-xfs/fs/xfs/support/debug.c
@@ -17,7 +17,6 @@
  */
 #include <xfs.h>
 #include "debug.h"
-#include "spin.h"
 
 static char		message[1024];	/* keep it off the stack */
 static DEFINE_SPINLOCK(xfs_err_lock);
Index: linux-2.6-xfs/fs/xfs/support/ktrace.h
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/support/ktrace.h
+++ linux-2.6-xfs/fs/xfs/support/ktrace.h
@@ -18,8 +18,6 @@
 #ifndef __XFS_SUPPORT_KTRACE_H__
 #define __XFS_SUPPORT_KTRACE_H__
 
-#include <spin.h>
-
 /*
  * Trace buffer entry structure.
  */
Index: linux-2.6-xfs/fs/xfs/xfs_alloc.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/xfs_alloc.c
+++ linux-2.6-xfs/fs/xfs/xfs_alloc.c
@@ -2206,7 +2206,7 @@ xfs_alloc_read_agf(
 			be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNOi]);
 		pag->pagf_levels[XFS_BTNUM_CNTi] =
 			be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNTi]);
-		spinlock_init(&pag->pagb_lock, "xfspagb");
+		spin_lock_init(&pag->pagb_lock);
 		pag->pagb_list = kmem_zalloc(XFS_PAGB_NUM_SLOTS *
 					sizeof(xfs_perag_busy_t), KM_SLEEP);
 		pag->pagf_init = 1;
Index: linux-2.6-xfs/fs/xfs/xfs_log.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/xfs_log.c
+++ linux-2.6-xfs/fs/xfs/xfs_log.c
@@ -1189,8 +1189,8 @@ xlog_alloc_log(xfs_mount_t	*mp,
 	ASSERT(XFS_BUF_VALUSEMA(bp) <= 0);
 	log->l_xbuf = bp;
 
-	spinlock_init(&log->l_icloglock, "iclog");
-	spinlock_init(&log->l_grant_lock, "grhead_iclog");
+	spin_lock_init(&log->l_icloglock);
+	spin_lock_init(&log->l_grant_lock);
 	initnsema(&log->l_flushsema, 0, "ic-flush");
 	xlog_state_ticket_alloc(log);  /* wait until after icloglock inited */
 
Index: linux-2.6-xfs/fs/xfs/xfs_mount.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/xfs_mount.c
+++ linux-2.6-xfs/fs/xfs/xfs_mount.c
@@ -136,8 +136,8 @@ xfs_mount_init(void)
 		mp->m_flags |= XFS_MOUNT_NO_PERCPU_SB;
 	}
 
-	spinlock_init(&mp->m_ail_lock, "xfs_ail");
-	spinlock_init(&mp->m_sb_lock, "xfs_sb");
+	spin_lock_init(&mp->m_ail_lock);
+	spin_lock_init(&mp->m_sb_lock);
 	mutex_init(&mp->m_ilock);
 	mutex_init(&mp->m_growlock);
 	/*
@@ -616,7 +616,7 @@ xfs_mount_common(xfs_mount_t *mp, xfs_sb
 	int	i;
 
 	mp->m_agfrotor = mp->m_agirotor = 0;
-	spinlock_init(&mp->m_agirotor_lock, "m_agirotor_lock");
+	spin_lock_init(&mp->m_agirotor_lock);
 	mp->m_maxagi = mp->m_sb.sb_agcount;
 	mp->m_blkbit_log = sbp->sb_blocklog + XFS_NBBYLOG;
 	mp->m_blkbb_log = sbp->sb_blocklog - BBSHIFT;
Index: linux-2.6-xfs/fs/xfs/xfs_mru_cache.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/xfs_mru_cache.c
+++ linux-2.6-xfs/fs/xfs/xfs_mru_cache.c
@@ -368,7 +368,7 @@ xfs_mru_cache_create(
 	 */
 	INIT_RADIX_TREE(&mru->store, GFP_ATOMIC);
 	INIT_LIST_HEAD(&mru->reap_list);
-	spinlock_init(&mru->lock, "xfs_mru_cache");
+	spin_lock_init(&mru->lock);
 	INIT_DELAYED_WORK(&mru->work, _xfs_mru_cache_reap);
 
 	mru->grp_time  = grp_time;
Index: linux-2.6-xfs/fs/xfs/xfs_vfsops.c
===================================================================
--- linux-2.6-xfs.orig/fs/xfs/xfs_vfsops.c
+++ linux-2.6-xfs/fs/xfs/xfs_vfsops.c
@@ -68,7 +68,7 @@ xfs_init(void)
 	extern kmem_zone_t	*xfs_dabuf_zone;
 #ifdef XFS_DABUF_DEBUG
 	extern spinlock_t        xfs_dabuf_global_lock;
-	spinlock_init(&xfs_dabuf_global_lock, "xfsda");
+	spin_lock_init(&xfs_dabuf_global_lock);
 #endif
 
 	/*

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH SERIES] untangle spinlock macros
  2007-09-12  1:51 ` Donald Douwsma
  2007-09-12  1:55   ` Eric Sandeen
  2007-09-12  2:07   ` Eric Sandeen
@ 2007-09-13  3:04   ` Eric Sandeen
  2 siblings, 0 replies; 13+ messages in thread
From: Eric Sandeen @ 2007-09-13  3:04 UTC (permalink / raw)
  To: Donald Douwsma; +Cc: xfs-oss

Donald Douwsma wrote:

> But here you use the name of the lock variable.
> 
>          /*
> -        * We actually don't have to acquire the SB_LOCK at all.
> +        * We actually don't have to acquire the m_sb_lock at all.
>           * This can only be called from mount, and that's single threaded. XXX
>           */

I was going to change this, but "sb lock" sounds way too generic to me...

-Eric

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH SERIES] untangle spinlock macros
  2007-09-13  3:02         ` Eric Sandeen
@ 2007-09-21 21:04           ` Russell Cattelan
  0 siblings, 0 replies; 13+ messages in thread
From: Russell Cattelan @ 2007-09-21 21:04 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: Christoph Hellwig, Lachlan McIlroy, Donald Douwsma, xfs-oss

[-- Attachment #1: Type: text/plain, Size: 8126 bytes --]

Eric Sandeen wrote:
> Christoph Hellwig wrote:
>   
>> On Wed, Sep 12, 2007 at 04:04:53PM +1000, Lachlan McIlroy wrote:
>>   
>>     
>>> These changes look good Eric.
>>>
>>> I'm in two minds about losing the spinlock_destroy() macros though.  If 
>>> Linux
>>> ever implements a spinlock teardown routine it would be nice to still have 
>>> all
>>> the placeholders still there.  Although I can't imagine it would do any more
>>> than assert that the lock is not currently held.  If someone else wants to 
>>> lose
>>> the macros then I'm not going to argue.
>>>     
>>>       
>> I'd say keep them for now.  We don't need the spin.h header for them anyway,
>> as single macro can simply move to xfs_linux.h
>>
>>
>>   
>>     
> Try this on for size.....
>
>   
So this is a bit late now but please please leave the names they are 
useful for tracking locks.
especially in the freebsd witness code.
> ======================
>
> remove spinlock init abstraction macro in spin.h, remove the callers, 
> and  remove the file.  Move no-op spinlock_destroy to xfs_linux.h
>
> Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
>
> Index: linux-2.6-xfs/fs/xfs/linux-2.6/spin.h
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/linux-2.6/spin.h
> +++ /dev/null
> @@ -1,27 +0,0 @@
> -/*
> - * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
> - * All Rights Reserved.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License as
> - * published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it would be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write the Free Software Foundation,
> - * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> - */
> -#ifndef __XFS_SUPPORT_SPIN_H__
> -#define __XFS_SUPPORT_SPIN_H__
> -
> -#include <linux/sched.h>	/* preempt needs this */
> -#include <linux/spinlock.h>
> -
> -#define spinlock_init(lock, name)	spin_lock_init(lock)
> -#define	spinlock_destroy(lock)
> -
> -#endif /* __XFS_SUPPORT_SPIN_H__ */
> Index: linux-2.6-xfs/fs/xfs/linux-2.6/xfs_buf.c
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/linux-2.6/xfs_buf.c
> +++ linux-2.6-xfs/fs/xfs/linux-2.6/xfs_buf.c
> @@ -1568,7 +1568,7 @@ xfs_alloc_delwrite_queue(
>  
>  	INIT_LIST_HEAD(&btp->bt_list);
>  	INIT_LIST_HEAD(&btp->bt_delwrite_queue);
> -	spinlock_init(&btp->bt_delwrite_lock, "delwri_lock");
> +	spin_lock_init(&btp->bt_delwrite_lock);
>  	btp->bt_flags = 0;
>  	btp->bt_task = kthread_run(xfsbufd, btp, "xfsbufd");
>  	if (IS_ERR(btp->bt_task)) {
> Index: linux-2.6-xfs/fs/xfs/linux-2.6/xfs_linux.h
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/linux-2.6/xfs_linux.h
> +++ linux-2.6-xfs/fs/xfs/linux-2.6/xfs_linux.h
> @@ -43,7 +43,6 @@
>  
>  #include <kmem.h>
>  #include <mrlock.h>
> -#include <spin.h>
>  #include <sv.h>
>  #include <mutex.h>
>  #include <sema.h>
> @@ -75,6 +74,7 @@
>  #include <linux/notifier.h>
>  #include <linux/delay.h>
>  #include <linux/log2.h>
> +#include <linux/spinlock.h>
>  
>  #include <asm/page.h>
>  #include <asm/div64.h>
> @@ -145,6 +145,8 @@
>  #define current_restore_flags_nested(sp, f)	\
>  		(current->flags = ((current->flags & ~(f)) | (*(sp) & (f))))
>  
> +#define spinlock_destroy(lock)
> +
>  #define NBPP		PAGE_SIZE
>  #define NDPP		(1 << (PAGE_SHIFT - 9))
>  
> Index: linux-2.6-xfs/fs/xfs/quota/xfs_qm.c
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/quota/xfs_qm.c
> +++ linux-2.6-xfs/fs/xfs/quota/xfs_qm.c
> @@ -1131,7 +1131,7 @@ xfs_qm_init_quotainfo(
>  		return error;
>  	}
>  
> -	spinlock_init(&qinf->qi_pinlock, "xfs_qinf_pin");
> +	spin_lock_init(&qinf->qi_pinlock);
>  	xfs_qm_list_init(&qinf->qi_dqlist, "mpdqlist", 0);
>  	qinf->qi_dqreclaims = 0;
>  
> Index: linux-2.6-xfs/fs/xfs/support/debug.c
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/support/debug.c
> +++ linux-2.6-xfs/fs/xfs/support/debug.c
> @@ -17,7 +17,6 @@
>   */
>  #include <xfs.h>
>  #include "debug.h"
> -#include "spin.h"
>  
>  static char		message[1024];	/* keep it off the stack */
>  static DEFINE_SPINLOCK(xfs_err_lock);
> Index: linux-2.6-xfs/fs/xfs/support/ktrace.h
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/support/ktrace.h
> +++ linux-2.6-xfs/fs/xfs/support/ktrace.h
> @@ -18,8 +18,6 @@
>  #ifndef __XFS_SUPPORT_KTRACE_H__
>  #define __XFS_SUPPORT_KTRACE_H__
>  
> -#include <spin.h>
> -
>  /*
>   * Trace buffer entry structure.
>   */
> Index: linux-2.6-xfs/fs/xfs/xfs_alloc.c
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/xfs_alloc.c
> +++ linux-2.6-xfs/fs/xfs/xfs_alloc.c
> @@ -2206,7 +2206,7 @@ xfs_alloc_read_agf(
>  			be32_to_cpu(agf->agf_levels[XFS_BTNUM_BNOi]);
>  		pag->pagf_levels[XFS_BTNUM_CNTi] =
>  			be32_to_cpu(agf->agf_levels[XFS_BTNUM_CNTi]);
> -		spinlock_init(&pag->pagb_lock, "xfspagb");
> +		spin_lock_init(&pag->pagb_lock);
>  		pag->pagb_list = kmem_zalloc(XFS_PAGB_NUM_SLOTS *
>  					sizeof(xfs_perag_busy_t), KM_SLEEP);
>  		pag->pagf_init = 1;
> Index: linux-2.6-xfs/fs/xfs/xfs_log.c
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/xfs_log.c
> +++ linux-2.6-xfs/fs/xfs/xfs_log.c
> @@ -1189,8 +1189,8 @@ xlog_alloc_log(xfs_mount_t	*mp,
>  	ASSERT(XFS_BUF_VALUSEMA(bp) <= 0);
>  	log->l_xbuf = bp;
>  
> -	spinlock_init(&log->l_icloglock, "iclog");
> -	spinlock_init(&log->l_grant_lock, "grhead_iclog");
> +	spin_lock_init(&log->l_icloglock);
> +	spin_lock_init(&log->l_grant_lock);
>  	initnsema(&log->l_flushsema, 0, "ic-flush");
>  	xlog_state_ticket_alloc(log);  /* wait until after icloglock inited */
>  
> Index: linux-2.6-xfs/fs/xfs/xfs_mount.c
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/xfs_mount.c
> +++ linux-2.6-xfs/fs/xfs/xfs_mount.c
> @@ -136,8 +136,8 @@ xfs_mount_init(void)
>  		mp->m_flags |= XFS_MOUNT_NO_PERCPU_SB;
>  	}
>  
> -	spinlock_init(&mp->m_ail_lock, "xfs_ail");
> -	spinlock_init(&mp->m_sb_lock, "xfs_sb");
> +	spin_lock_init(&mp->m_ail_lock);
> +	spin_lock_init(&mp->m_sb_lock);
>  	mutex_init(&mp->m_ilock);
>  	mutex_init(&mp->m_growlock);
>  	/*
> @@ -616,7 +616,7 @@ xfs_mount_common(xfs_mount_t *mp, xfs_sb
>  	int	i;
>  
>  	mp->m_agfrotor = mp->m_agirotor = 0;
> -	spinlock_init(&mp->m_agirotor_lock, "m_agirotor_lock");
> +	spin_lock_init(&mp->m_agirotor_lock);
>  	mp->m_maxagi = mp->m_sb.sb_agcount;
>  	mp->m_blkbit_log = sbp->sb_blocklog + XFS_NBBYLOG;
>  	mp->m_blkbb_log = sbp->sb_blocklog - BBSHIFT;
> Index: linux-2.6-xfs/fs/xfs/xfs_mru_cache.c
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/xfs_mru_cache.c
> +++ linux-2.6-xfs/fs/xfs/xfs_mru_cache.c
> @@ -368,7 +368,7 @@ xfs_mru_cache_create(
>  	 */
>  	INIT_RADIX_TREE(&mru->store, GFP_ATOMIC);
>  	INIT_LIST_HEAD(&mru->reap_list);
> -	spinlock_init(&mru->lock, "xfs_mru_cache");
> +	spin_lock_init(&mru->lock);
>  	INIT_DELAYED_WORK(&mru->work, _xfs_mru_cache_reap);
>  
>  	mru->grp_time  = grp_time;
> Index: linux-2.6-xfs/fs/xfs/xfs_vfsops.c
> ===================================================================
> --- linux-2.6-xfs.orig/fs/xfs/xfs_vfsops.c
> +++ linux-2.6-xfs/fs/xfs/xfs_vfsops.c
> @@ -68,7 +68,7 @@ xfs_init(void)
>  	extern kmem_zone_t	*xfs_dabuf_zone;
>  #ifdef XFS_DABUF_DEBUG
>  	extern spinlock_t        xfs_dabuf_global_lock;
> -	spinlock_init(&xfs_dabuf_global_lock, "xfsda");
> +	spin_lock_init(&xfs_dabuf_global_lock);
>  #endif
>  
>  	/*
>
>
>   


[-- Attachment #2: cattelan.vcf --]
[-- Type: text/x-vcard, Size: 131 bytes --]

begin:vcard
fn:Russell Cattelan
n:Cattelan;Russell
email;internet:cattelan@thebarn.com
x-mozilla-html:FALSE
version:2.1
end:vcard


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2007-09-21 22:31 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-11  5:05 [PATCH SERIES] untangle spinlock macros Eric Sandeen
2007-09-12  1:06 ` Lachlan McIlroy
2007-09-12  1:35   ` Eric Sandeen
2007-09-12  5:50     ` Lachlan McIlroy
2007-09-12 14:32       ` Eric Sandeen
2007-09-12  1:51 ` Donald Douwsma
2007-09-12  1:55   ` Eric Sandeen
2007-09-12  2:07   ` Eric Sandeen
2007-09-12  6:04     ` Lachlan McIlroy
2007-09-12  8:29       ` Christoph Hellwig
2007-09-13  3:02         ` Eric Sandeen
2007-09-21 21:04           ` Russell Cattelan
2007-09-13  3:04   ` Eric Sandeen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox