Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 794ee1ba authored by Jes Sorensen's avatar Jes Sorensen Committed by Ingo Molnar
Browse files

[PATCH] mutex subsystem, semaphore to mutex: XFS



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.

Signed-off-by: default avatarJes Sorensen <jes@trained-monkey.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent de5097c2
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -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__ */
+2 −2
Original line number Diff line number Diff line
@@ -104,7 +104,7 @@ xfs_qm_dqinit(
	 */
	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 @@ void
xfs_dqlock(
	xfs_dquot_t *dqp)
{
	mutex_lock(&(dqp->q_qlock), PINOD);
	mutex_lock(&(dqp->q_qlock));
}

void
+5 −5
Original line number Diff line number Diff line
@@ -167,7 +167,7 @@ xfs_Gqm_init(void)
	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 @@ xfs_qm_init_quotainfo(
	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 @@ xfs_qm_list_init(
	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 @@ STATIC void
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_qm_freelist_destroy(xfs_frlist_t *ql)
{
	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);
+1 −1
Original line number Diff line number Diff line
@@ -165,7 +165,7 @@ typedef struct xfs_dquot_acct {
#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--)
+1 −1
Original line number Diff line number Diff line
@@ -363,7 +363,7 @@ xfs_qm_init(void)
		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();
}
Loading