Skip to contentSkip to conversation

updates XFS mutex patch

PATCH In review Jes Sorensen 4 participants 9 messages Dec 29, 2005 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 updates XFS mutex patch

Hi,

Please find attached an updated patch for the XFS using MUTEX patch.

Note this is a replacement patch for the previous one.

Cheers,
Jes

This patch switches XFS over to use the new mutex code directly as opposed to the previous workaround patch I posted earlier that avoided the namespace clash by forcing it back to semaphores. This falls in the 'works for me<tm>' category.

----

 fs/xfs/linux-2.6/mutex.h       |   13 ++++++-------
 fs/xfs/quota/xfs_dquot.c       |    4 ++--
 fs/xfs/quota/xfs_qm.c          |   10 +++++-----
 fs/xfs/quota/xfs_qm.h          |    2 +-
 fs/xfs/quota/xfs_qm_bhv.c      |    2 +-
 fs/xfs/quota/xfs_qm_syscalls.c |    8 ++++----
 fs/xfs/quota/xfs_quota_priv.h  |    2 +-
 fs/xfs/support/uuid.c          |    6 +++---
 fs/xfs/xfs_mount.c             |    2 +-
 fs/xfs/xfs_mount.h             |    2 +-
 10 files changed, 25 insertions(+), 26 deletions(-)
fs/xfs/linux-2.6/mutex.h +6 -7
Index: linux-2.6.15-rc7-quilt/fs/xfs/linux-2.6/mutex.h
===================================================================
@@ -19,7 +19,7 @@
 #define __XFS_SUPPORT_MUTEX_H__
 
 #include <linux/spinlock.h>
-#include <asm/semaphore.h>
+#include <linux/mutex.h>
 
 /*
  * Map the mutex'es from IRIX to Linux semaphores.
@@ -28,12 +28,11 @@
  * callers.
  */
 #define MUTEX_DEFAULT		0x0
-typedef struct semaphore	mutex_t;
 
-#define mutex_init(lock, type, name)		sema_init(lock, 1)
-#define mutex_destroy(lock)			sema_init(lock, -99)
-#define mutex_lock(lock, num)			down(lock)
-#define mutex_trylock(lock)			(down_trylock(lock) ? 0 : 1)
-#define mutex_unlock(lock)			up(lock)
+typedef struct mutex		mutex_t;
+
+#define xfs_mutex_init(lock, type, name)	mutex_init(lock)
+#define xfs_mutex_lock(lock, type)		mutex_lock(lock)
+#define mutex_destroy(lock)			do{}while(0)
 
 #endif /* __XFS_SUPPORT_MUTEX_H__ */
fs/xfs/quota/xfs_dquot.c +2 -2
Index: linux-2.6.15-rc7-quilt/fs/xfs/quota/xfs_dquot.c
===================================================================
@@ -104,7 +104,7 @@
 	 */
 	if (brandnewdquot) {
 		dqp->dq_flnext = dqp->dq_flprev = dqp;
-		mutex_init(&dqp->q_qlock,  MUTEX_DEFAULT, "xdq");
+		xfs_mutex_init(&dqp->q_qlock,  MUTEX_DEFAULT, "xdq");
 		initnsema(&dqp->q_flock, 1, "fdq");
 		sv_init(&dqp->q_pinwait, SV_DEFAULT, "pdq");
 
@@ -1382,7 +1382,7 @@
 xfs_dqlock(
 	xfs_dquot_t *dqp)
 {
-	mutex_lock(&(dqp->q_qlock), PINOD);
+	xfs_mutex_lock(&(dqp->q_qlock), PINOD);
 }
 
 void
fs/xfs/quota/xfs_qm.c +5 -5
Index: linux-2.6.15-rc7-quilt/fs/xfs/quota/xfs_qm.c
===================================================================
@@ -167,7 +167,7 @@
 	xqm->qm_dqfree_ratio = XFS_QM_DQFREE_RATIO;
 	xqm->qm_nrefs = 0;
 #ifdef DEBUG
-	mutex_init(&qcheck_lock, MUTEX_DEFAULT, "qchk");
+	xfs_mutex_init(&qcheck_lock, MUTEX_DEFAULT, "qchk");
 #endif
 	return xqm;
 }
@@ -1166,7 +1166,7 @@
 	qinf->qi_dqreclaims = 0;
 
 	/* mutex used to serialize quotaoffs */
-	mutex_init(&qinf->qi_quotaofflock, MUTEX_DEFAULT, "qoff");
+	xfs_mutex_init(&qinf->qi_quotaofflock, MUTEX_DEFAULT, "qoff");
 
 	/* Precalc some constants */
 	qinf->qi_dqchunklen = XFS_FSB_TO_BB(mp, XFS_DQUOT_CLUSTER_SIZE_FSB);
@@ -1285,7 +1285,7 @@
 	char		*str,
 	int		n)
 {
-	mutex_init(&list->qh_lock, MUTEX_DEFAULT, str);
+	xfs_mutex_init(&list->qh_lock, MUTEX_DEFAULT, str);
 	list->qh_next = NULL;
 	list->qh_version = 0;
 	list->qh_nelems = 0;
@@ -2762,7 +2762,7 @@
 xfs_qm_freelist_init(xfs_frlist_t *ql)
 {
 	ql->qh_next = ql->qh_prev = (xfs_dquot_t *) ql;
-	mutex_init(&ql->qh_lock, MUTEX_DEFAULT, "dqf");
+	xfs_mutex_init(&ql->qh_lock, MUTEX_DEFAULT, "dqf");
 	ql->qh_version = 0;
 	ql->qh_nelems = 0;
 }
@@ -2772,7 +2772,7 @@
 {
 	xfs_dquot_t	*dqp, *nextdqp;
 
-	mutex_lock(&ql->qh_lock, PINOD);
+	xfs_mutex_lock(&ql->qh_lock, PINOD);
 	for (dqp = ql->qh_next;
 	     dqp != (xfs_dquot_t *)ql; ) {
 		xfs_dqlock(dqp);
fs/xfs/quota/xfs_qm.h +1 -1
Index: linux-2.6.15-rc7-quilt/fs/xfs/quota/xfs_qm.h
===================================================================
@@ -165,7 +165,7 @@
 #define XFS_QM_IWARNLIMIT	5
 #define XFS_QM_RTBWARNLIMIT	5
 
-#define XFS_QM_LOCK(xqm)	(mutex_lock(&xqm##_lock, PINOD))
+#define XFS_QM_LOCK(xqm)	(xfs_mutex_lock(&xqm##_lock, PINOD))
 #define XFS_QM_UNLOCK(xqm)	(mutex_unlock(&xqm##_lock))
 #define XFS_QM_HOLD(xqm)	((xqm)->qm_nrefs++)
 #define XFS_QM_RELE(xqm)	((xqm)->qm_nrefs--)
fs/xfs/quota/xfs_qm_bhv.c +1 -1
Index: linux-2.6.15-rc7-quilt/fs/xfs/quota/xfs_qm_bhv.c
===================================================================
@@ -363,7 +363,7 @@
 		KERN_INFO "SGI XFS Quota Management subsystem\n";
 
 	printk(message);
-	mutex_init(&xfs_Gqm_lock, MUTEX_DEFAULT, "xfs_qmlock");
+	xfs_mutex_init(&xfs_Gqm_lock, MUTEX_DEFAULT, "xfs_qmlock");
 	vfs_bhv_set_custom(&xfs_qmops, &xfs_qmcore_xfs);
 	xfs_qm_init_procfs();
 }
fs/xfs/quota/xfs_qm_syscalls.c +4 -4
Index: linux-2.6.15-rc7-quilt/fs/xfs/quota/xfs_qm_syscalls.c
===================================================================
@@ -233,7 +233,7 @@
 	 */
 	ASSERT(mp->m_quotainfo);
 	if (mp->m_quotainfo)
-		mutex_lock(&(XFS_QI_QOFFLOCK(mp)), PINOD);
+		xfs_mutex_lock(&(XFS_QI_QOFFLOCK(mp)), PINOD);
 
 	ASSERT(mp->m_quotainfo);
 
@@ -508,7 +508,7 @@
 	/*
 	 * Switch on quota enforcement in core.
 	 */
-	mutex_lock(&(XFS_QI_QOFFLOCK(mp)), PINOD);
+	xfs_mutex_lock(&(XFS_QI_QOFFLOCK(mp)), PINOD);
 	mp->m_qflags |= (flags & XFS_ALL_QUOTA_ENFD);
 	mutex_unlock(&(XFS_QI_QOFFLOCK(mp)));
 
@@ -617,7 +617,7 @@
 	 * a quotaoff from happening). (XXXThis doesn't currently happen
 	 * because we take the vfslock before calling xfs_qm_sysent).
 	 */
-	mutex_lock(&(XFS_QI_QOFFLOCK(mp)), PINOD);
+	xfs_mutex_lock(&(XFS_QI_QOFFLOCK(mp)), PINOD);
 
 	/*
 	 * Get the dquot (locked), and join it to the transaction.
@@ -1426,7 +1426,7 @@
 	xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE | XFS_LOG_SYNC);
 	XFS_bflush(mp->m_ddev_targp);
 
-	mutex_lock(&qcheck_lock, PINOD);
+	xfs_mutex_lock(&qcheck_lock, PINOD);
 	/* There should be absolutely no quota activity while this
 	   is going on. */
 	qmtest_udqtab = kmem_zalloc(qmtest_hashmask *
fs/xfs/quota/xfs_quota_priv.h +1 -1
Index: linux-2.6.15-rc7-quilt/fs/xfs/quota/xfs_quota_priv.h
===================================================================
@@ -51,7 +51,7 @@
 #define XFS_QI_MPLNEXT(mp)	((mp)->m_quotainfo->qi_dqlist.qh_next)
 #define XFS_QI_MPLNDQUOTS(mp)	((mp)->m_quotainfo->qi_dqlist.qh_nelems)
 
-#define XQMLCK(h)			(mutex_lock(&((h)->qh_lock), PINOD))
+#define XQMLCK(h)			(xfs_mutex_lock(&((h)->qh_lock), PINOD))
 #define XQMUNLCK(h)			(mutex_unlock(&((h)->qh_lock)))
 #ifdef DEBUG
 struct xfs_dqhash;
fs/xfs/support/uuid.c +3 -3
Index: linux-2.6.15-rc7-quilt/fs/xfs/support/uuid.c
===================================================================
@@ -24,7 +24,7 @@
 void
 uuid_init(void)
 {
-	mutex_init(&uuid_monitor, MUTEX_DEFAULT, "uuid_monitor");
+	xfs_mutex_init(&uuid_monitor, MUTEX_DEFAULT, "uuid_monitor");
 }
 
 /*
@@ -94,7 +94,7 @@
 {
 	int	i, hole;
 
-	mutex_lock(&uuid_monitor, PVFS);
+	xfs_mutex_lock(&uuid_monitor, PVFS);
 	for (i = 0, hole = -1; i < uuid_table_size; i++) {
 		if (uuid_is_nil(&uuid_table[i])) {
 			hole = i;
@@ -122,7 +122,7 @@
 {
 	int	i;
 
-	mutex_lock(&uuid_monitor, PVFS);
+	xfs_mutex_lock(&uuid_monitor, PVFS);
 	for (i = 0; i < uuid_table_size; i++) {
 		if (uuid_is_nil(&uuid_table[i]))
 			continue;
fs/xfs/xfs_mount.c +1 -1
Index: linux-2.6.15-rc7-quilt/fs/xfs/xfs_mount.c
===================================================================
@@ -117,7 +117,7 @@
 
 	AIL_LOCKINIT(&mp->m_ail_lock, "xfs_ail");
 	spinlock_init(&mp->m_sb_lock, "xfs_sb");
-	mutex_init(&mp->m_ilock, MUTEX_DEFAULT, "xfs_ilock");
+	xfs_mutex_init(&mp->m_ilock, MUTEX_DEFAULT, "xfs_ilock");
 	initnsema(&mp->m_growlock, 1, "xfs_grow");
 	/*
 	 * Initialize the AIL.
fs/xfs/xfs_mount.h +1 -1
Index: linux-2.6.15-rc7-quilt/fs/xfs/xfs_mount.h
===================================================================
@@ -533,7 +533,7 @@
 	int		msb_delta;	/* Change to make to specified field */
 } xfs_mod_sb_t;
 
-#define	XFS_MOUNT_ILOCK(mp)	mutex_lock(&((mp)->m_ilock), PINOD)
+#define	XFS_MOUNT_ILOCK(mp)	xfs_mutex_lock(&((mp)->m_ilock), PINOD)
 #define	XFS_MOUNT_IUNLOCK(mp)	mutex_unlock(&((mp)->m_ilock))
 #define	XFS_SB_LOCK(mp)		mutex_spinlock(&(mp)->m_sb_lock)
 #define	XFS_SB_UNLOCK(mp,s)	mutex_spinunlock(&(mp)->m_sb_lock,(s))
#1 lore raw

fs/xfs/linux-2.6/mutex.h line 36

Quoted 4 lines · Jes Sorensen
fs/xfs/linux-2.6/mutex.h +4 -0
+
+#define xfs_mutex_init(lock, type, name)	mutex_init(lock)
+#define xfs_mutex_lock(lock, type)		mutex_lock(lock)
+#define mutex_destroy(lock)			do{}while(0)

why not just change all mutex_init users to only pass lock? (same for the others) eg why add another abstraction instead of fixing the caller?

#2 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arjan" == Arjan van de Ven <[email protected]> writes:

Quoted 3 lines · Jes Sorensen
Quoted 3 lines

+ +#define xfs_mutex_init(lock, type, name) mutex_init(lock) +#define xfs_mutex_lock(lock, type) mutex_lock(lock) +#define mutex_destroy(lock) do{}while(0)

Arjan> why not just change all mutex_init users to only pass lock? Arjan> (same for the others) eg why add another abstraction instead of Arjan> fixing the caller?

I have no objections to this, however I am not sure if the XFS guys try to maintain some level of source compatibility. Just trying to play nicely, but I agree that would be cleaner.

Cheers,
Jes

#3 lore raw
In reply to Jes Sorensen
Quoted 1 line · Jes Sorensen

+#define mutex_destroy(lock) do{}while(0)

FYI, there's now a mutex_destroy() op provided by mutex.h, which is functional if CONFIG_DEBUG_MUTEXES is enabled. (it hasnt been tested much though)

Ingo

#4 lore raw
In reply to Jes Sorensen
Quoted 7 lines · Jes Sorensen

Hi,

Please find attached an updated patch for the XFS using MUTEX patch.

Note this is a replacement patch for the previous one.

Quoted 7 lines

Cheers,
Jes

This patch switches XFS over to use the new mutex code directly as opposed to the previous workaround patch I posted earlier that avoided the namespace clash by forcing it back to semaphores. This falls in the 'works for me<tm>' category.

It's say just switch XFS to the one-arg mutex_init variant.

And ingo. please add the mutex_t typedef, analogue to spinlock_t it's a totally opaqueue to the users type, so it really should be a typedef. After that the XFS mutex.h can just go away.

#5 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Christoph" == Christoph Hellwig <[email protected]> writes:

Christoph> On Thu, Dec 29, 2005 at 05:59:35AM -0500, Jes Sorensen

Quoted 4 lines · Christoph> wrote:
Quoted 4 lines

This patch switches XFS over to use the new mutex code directly as opposed to the previous workaround patch I posted earlier that avoided the namespace clash by forcing it back to semaphores. This falls in the 'works for me<tm>' category.

Christoph> It's say just switch XFS to the one-arg mutex_init variant.

Ok,

One for the blame Christoph files then ;-)

How about this one?

Cheers,
Jes

This patch switches XFS over to use the new mutex code directly as opposed to the previous workaround patch I posted earlier that avoided the namespace clash by forcing it back to semaphores. This falls in the 'works for me<tm>' category.

----

 fs/xfs/linux-2.6/mutex.h       |   10 +++-------
 fs/xfs/quota/xfs_dquot.c       |    4 ++--
 fs/xfs/quota/xfs_qm.c          |   10 +++++-----
 fs/xfs/quota/xfs_qm.h          |    2 +-
 fs/xfs/quota/xfs_qm_bhv.c      |    2 +-
 fs/xfs/quota/xfs_qm_syscalls.c |    8 ++++----
 fs/xfs/quota/xfs_quota_priv.h  |    2 +-
 fs/xfs/support/uuid.c          |    6 +++---
 fs/xfs/xfs_mount.c             |    2 +-
 fs/xfs/xfs_mount.h             |    2 +-
 10 files changed, 22 insertions(+), 26 deletions(-)
fs/xfs/linux-2.6/mutex.h +3 -7
Index: linux-2.6.15-rc7-quilt/fs/xfs/linux-2.6/mutex.h
===================================================================
@@ -19,7 +19,7 @@
 #define __XFS_SUPPORT_MUTEX_H__
 
 #include <linux/spinlock.h>
-#include <asm/semaphore.h>
+#include <linux/mutex.h>
 
 /*
  * Map the mutex'es from IRIX to Linux semaphores.
@@ -28,12 +28,8 @@
  * callers.
  */
 #define MUTEX_DEFAULT		0x0
-typedef struct semaphore	mutex_t;
 
-#define mutex_init(lock, type, name)		sema_init(lock, 1)
-#define mutex_destroy(lock)			sema_init(lock, -99)
-#define mutex_lock(lock, num)			down(lock)
-#define mutex_trylock(lock)			(down_trylock(lock) ? 0 : 1)
-#define mutex_unlock(lock)			up(lock)
+typedef struct mutex		mutex_t;
+#define mutex_destroy(lock)			do{}while(0)
 
 #endif /* __XFS_SUPPORT_MUTEX_H__ */
fs/xfs/quota/xfs_dquot.c +2 -2
Index: linux-2.6.15-rc7-quilt/fs/xfs/quota/xfs_dquot.c
===================================================================
@@ -104,7 +104,7 @@
 	 */
 	if (brandnewdquot) {
 		dqp->dq_flnext = dqp->dq_flprev = dqp;
-		mutex_init(&dqp->q_qlock,  MUTEX_DEFAULT, "xdq");
+		mutex_init(&dqp->q_qlock);
 		initnsema(&dqp->q_flock, 1, "fdq");
 		sv_init(&dqp->q_pinwait, SV_DEFAULT, "pdq");
 
@@ -1382,7 +1382,7 @@
 xfs_dqlock(
 	xfs_dquot_t *dqp)
 {
-	mutex_lock(&(dqp->q_qlock), PINOD);
+	mutex_lock(&(dqp->q_qlock));
 }
 
 void
fs/xfs/quota/xfs_qm.c +5 -5
Index: linux-2.6.15-rc7-quilt/fs/xfs/quota/xfs_qm.c
===================================================================
@@ -167,7 +167,7 @@
 	xqm->qm_dqfree_ratio = XFS_QM_DQFREE_RATIO;
 	xqm->qm_nrefs = 0;
 #ifdef DEBUG
-	mutex_init(&qcheck_lock, MUTEX_DEFAULT, "qchk");
+	xfs_mutex_init(&qcheck_lock, MUTEX_DEFAULT, "qchk");
 #endif
 	return xqm;
 }
@@ -1166,7 +1166,7 @@
 	qinf->qi_dqreclaims = 0;
 
 	/* mutex used to serialize quotaoffs */
-	mutex_init(&qinf->qi_quotaofflock, MUTEX_DEFAULT, "qoff");
+	mutex_init(&qinf->qi_quotaofflock);
 
 	/* Precalc some constants */
 	qinf->qi_dqchunklen = XFS_FSB_TO_BB(mp, XFS_DQUOT_CLUSTER_SIZE_FSB);
@@ -1285,7 +1285,7 @@
 	char		*str,
 	int		n)
 {
-	mutex_init(&list->qh_lock, MUTEX_DEFAULT, str);
+	mutex_init(&list->qh_lock);
 	list->qh_next = NULL;
 	list->qh_version = 0;
 	list->qh_nelems = 0;
@@ -2762,7 +2762,7 @@
 xfs_qm_freelist_init(xfs_frlist_t *ql)
 {
 	ql->qh_next = ql->qh_prev = (xfs_dquot_t *) ql;
-	mutex_init(&ql->qh_lock, MUTEX_DEFAULT, "dqf");
+	mutex_init(&ql->qh_lock);
 	ql->qh_version = 0;
 	ql->qh_nelems = 0;
 }
@@ -2772,7 +2772,7 @@
 {
 	xfs_dquot_t	*dqp, *nextdqp;
 
-	mutex_lock(&ql->qh_lock, PINOD);
+	mutex_lock(&ql->qh_lock);
 	for (dqp = ql->qh_next;
 	     dqp != (xfs_dquot_t *)ql; ) {
 		xfs_dqlock(dqp);
fs/xfs/quota/xfs_qm.h +1 -1
Index: linux-2.6.15-rc7-quilt/fs/xfs/quota/xfs_qm.h
===================================================================
@@ -165,7 +165,7 @@
 #define XFS_QM_IWARNLIMIT	5
 #define XFS_QM_RTBWARNLIMIT	5
 
-#define XFS_QM_LOCK(xqm)	(mutex_lock(&xqm##_lock, PINOD))
+#define XFS_QM_LOCK(xqm)	(mutex_lock(&xqm##_lock))
 #define XFS_QM_UNLOCK(xqm)	(mutex_unlock(&xqm##_lock))
 #define XFS_QM_HOLD(xqm)	((xqm)->qm_nrefs++)
 #define XFS_QM_RELE(xqm)	((xqm)->qm_nrefs--)
fs/xfs/quota/xfs_qm_bhv.c +1 -1
Index: linux-2.6.15-rc7-quilt/fs/xfs/quota/xfs_qm_bhv.c
===================================================================
@@ -363,7 +363,7 @@
 		KERN_INFO "SGI XFS Quota Management subsystem\n";
 
 	printk(message);
-	mutex_init(&xfs_Gqm_lock, MUTEX_DEFAULT, "xfs_qmlock");
+	mutex_init(&xfs_Gqm_lock);
 	vfs_bhv_set_custom(&xfs_qmops, &xfs_qmcore_xfs);
 	xfs_qm_init_procfs();
 }
fs/xfs/quota/xfs_qm_syscalls.c +4 -4
Index: linux-2.6.15-rc7-quilt/fs/xfs/quota/xfs_qm_syscalls.c
===================================================================
@@ -233,7 +233,7 @@
 	 */
 	ASSERT(mp->m_quotainfo);
 	if (mp->m_quotainfo)
-		mutex_lock(&(XFS_QI_QOFFLOCK(mp)), PINOD);
+		mutex_lock(&(XFS_QI_QOFFLOCK(mp)));
 
 	ASSERT(mp->m_quotainfo);
 
@@ -508,7 +508,7 @@
 	/*
 	 * Switch on quota enforcement in core.
 	 */
-	mutex_lock(&(XFS_QI_QOFFLOCK(mp)), PINOD);
+	mutex_lock(&(XFS_QI_QOFFLOCK(mp)));
 	mp->m_qflags |= (flags & XFS_ALL_QUOTA_ENFD);
 	mutex_unlock(&(XFS_QI_QOFFLOCK(mp)));
 
@@ -617,7 +617,7 @@
 	 * a quotaoff from happening). (XXXThis doesn't currently happen
 	 * because we take the vfslock before calling xfs_qm_sysent).
 	 */
-	mutex_lock(&(XFS_QI_QOFFLOCK(mp)), PINOD);
+	mutex_lock(&(XFS_QI_QOFFLOCK(mp)));
 
 	/*
 	 * Get the dquot (locked), and join it to the transaction.
@@ -1426,7 +1426,7 @@
 	xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE | XFS_LOG_SYNC);
 	XFS_bflush(mp->m_ddev_targp);
 
-	mutex_lock(&qcheck_lock, PINOD);
+	mutex_lock(&qcheck_lock);
 	/* There should be absolutely no quota activity while this
 	   is going on. */
 	qmtest_udqtab = kmem_zalloc(qmtest_hashmask *
fs/xfs/quota/xfs_quota_priv.h +1 -1
Index: linux-2.6.15-rc7-quilt/fs/xfs/quota/xfs_quota_priv.h
===================================================================
@@ -51,7 +51,7 @@
 #define XFS_QI_MPLNEXT(mp)	((mp)->m_quotainfo->qi_dqlist.qh_next)
 #define XFS_QI_MPLNDQUOTS(mp)	((mp)->m_quotainfo->qi_dqlist.qh_nelems)
 
-#define XQMLCK(h)			(mutex_lock(&((h)->qh_lock), PINOD))
+#define XQMLCK(h)			(mutex_lock(&((h)->qh_lock)))
 #define XQMUNLCK(h)			(mutex_unlock(&((h)->qh_lock)))
 #ifdef DEBUG
 struct xfs_dqhash;
fs/xfs/support/uuid.c +3 -3
Index: linux-2.6.15-rc7-quilt/fs/xfs/support/uuid.c
===================================================================
@@ -24,7 +24,7 @@
 void
 uuid_init(void)
 {
-	mutex_init(&uuid_monitor, MUTEX_DEFAULT, "uuid_monitor");
+	mutex_init(&uuid_monitor);
 }
 
 /*
@@ -94,7 +94,7 @@
 {
 	int	i, hole;
 
-	mutex_lock(&uuid_monitor, PVFS);
+	mutex_lock(&uuid_monitor);
 	for (i = 0, hole = -1; i < uuid_table_size; i++) {
 		if (uuid_is_nil(&uuid_table[i])) {
 			hole = i;
@@ -122,7 +122,7 @@
 {
 	int	i;
 
-	mutex_lock(&uuid_monitor, PVFS);
+	mutex_lock(&uuid_monitor);
 	for (i = 0; i < uuid_table_size; i++) {
 		if (uuid_is_nil(&uuid_table[i]))
 			continue;
fs/xfs/xfs_mount.c +1 -1
Index: linux-2.6.15-rc7-quilt/fs/xfs/xfs_mount.c
===================================================================
@@ -117,7 +117,7 @@
 
 	AIL_LOCKINIT(&mp->m_ail_lock, "xfs_ail");
 	spinlock_init(&mp->m_sb_lock, "xfs_sb");
-	mutex_init(&mp->m_ilock, MUTEX_DEFAULT, "xfs_ilock");
+	mutex_init(&mp->m_ilock);
 	initnsema(&mp->m_growlock, 1, "xfs_grow");
 	/*
 	 * Initialize the AIL.
fs/xfs/xfs_mount.h +1 -1
Index: linux-2.6.15-rc7-quilt/fs/xfs/xfs_mount.h
===================================================================
@@ -533,7 +533,7 @@
 	int		msb_delta;	/* Change to make to specified field */
 } xfs_mod_sb_t;
 
-#define	XFS_MOUNT_ILOCK(mp)	mutex_lock(&((mp)->m_ilock), PINOD)
+#define	XFS_MOUNT_ILOCK(mp)	mutex_lock(&((mp)->m_ilock))
 #define	XFS_MOUNT_IUNLOCK(mp)	mutex_unlock(&((mp)->m_ilock))
 #define	XFS_SB_LOCK(mp)		mutex_spinlock(&(mp)->m_sb_lock)
 #define	XFS_SB_UNLOCK(mp,s)	mutex_spinunlock(&(mp)->m_sb_lock,(s))
#6 lore raw
In reply to Christoph Hellwig
Quoted 5 lines · Christoph Hellwig

It's say just switch XFS to the one-arg mutex_init variant.

And ingo. please add the mutex_t typedef, analogue to spinlock_t it's a totally opaqueue to the users type, so it really should be a typedef. After that the XFS mutex.h can just go away.

that's not possible, due to DEFINE_MUTEX() and due to struct mutex being embedded in other structures. I dont think we want to lose that property of struct semaphore, and only restrict mutex usage to pointers.

Ingo

#7 lore raw
Quoted 5 lines · Ingo Molnar
Quoted 2 lines · Christoph Hellwig

It's say just switch XFS to the one-arg mutex_init variant.

Quoted 7 lines
Quoted 3 lines

And ingo. please add the mutex_t typedef, analogue to spinlock_t it's a totally opaqueue to the users type, so it really should be a typedef. After that the XFS mutex.h can just go away.

that's not possible, due to DEFINE_MUTEX() and due to struct mutex being embedded in other structures. I dont think we want to lose that property of struct semaphore, and only restrict mutex usage to pointers.

Sorry, but I don't get this sentence at all. Can you try to rephrase it? What does DEFINE_MUTEX have to do with declaring either a typedef or structure?

#8 lore raw
Quoted 6 lines · Christoph Hellwig
Quoted 6 lines
Quoted 5 lines

It's say just switch XFS to the one-arg mutex_init variant.

And ingo. please add the mutex_t typedef, analogue to spinlock_t it's a totally opaqueue to the users type, so it really should be a typedef. After that the XFS mutex.h can just go away.

Quoted 7 lines
Quoted 3 lines

that's not possible, due to DEFINE_MUTEX() and due to struct mutex being embedded in other structures. I dont think we want to lose that property of struct semaphore, and only restrict mutex usage to pointers.

Sorry, but I don't get this sentence at all. Can you try to rephrase it? What does DEFINE_MUTEX have to do with declaring either a typedef or structure?

i think i misunderstood you. I thought you wanted a mutex_t a'la kmem_cache_t (which is only fully defined in mm/slab.c) - for the purpose of hiding the implementation of mutex_t. If the implementation of mutex_t is still present in mutex.h, i dont see what the advantage is. What's the difference between 'struct mutex' and 'mutex_t', besides that first one being clearer that here we have a kernel object? (we generally use the _t types for type-safe variations of integer types, e.g. pte_t.)

Ingo