Skip to contentSkip to conversation

- remove unused variable from locking macros

PATCH In review Eric Sandeen 3 participants 4 messages Jul 20, 2007 – Jul 23, 2007 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 7/7 - remove unused variable from locking macros

The "s" in these locking macros used to be used like flags in spin_lock_irqsave; but in the xfs codebase today it's never used.

gcc optimizes it away, but still, why keep it around?

fs/xfs/linux-2.4/spin.h +2 -5
Index: linux/fs/xfs/linux-2.4/spin.h
===================================================================
@@ -30,15 +30,12 @@
 
 typedef spinlock_t lock_t;
 
-#define SPLDECL(s)			unsigned long s
 #define DEFINE_SPINLOCK(s)		spinlock_t s = SPIN_LOCK_UNLOCKED
 
 #define spinlock_init(lock, name)	spin_lock_init(lock)
 #define	spinlock_destroy(lock)
-#define mutex_spinlock(lock)		({ spin_lock(lock); 0; })
-#define mutex_spinunlock(lock, s)	do { spin_unlock(lock); (void)s; } while (0)
-#define nested_spinlock(lock)		spin_lock(lock)
-#define nested_spinunlock(lock)		spin_unlock(lock)
+#define mutex_spinlock(lock)		spin_lock(lock)
+#define mutex_spinunlock(lock)		spin_unlock(lock)
 
 #ifndef HAVE_WRITE_TRYLOCK
 #define write_trylock(lock)		(0)
fs/xfs/linux-2.4/xfs_super.c +1 -1
Index: linux/fs/xfs/linux-2.4/xfs_super.c
===================================================================
@@ -405,7 +405,7 @@ xfs_fs_clear_inode(
 
 	VN_LOCK(vp);
 	vp->v_flag &= ~VMODIFIED;
-	VN_UNLOCK(vp, 0);
+	VN_UNLOCK(vp);
 
 	if (VNHEAD(vp))
 		if (bhv_vop_reclaim(vp))
fs/xfs/linux-2.4/xfs_vnode.c +1 -1
Index: linux/fs/xfs/linux-2.4/xfs_vnode.c
===================================================================
@@ -144,7 +144,7 @@ vn_hold(
 	VN_LOCK(vp);
 	inode = igrab(vn_to_inode(vp));
 	ASSERT(inode);
-	VN_UNLOCK(vp, 0);
+	VN_UNLOCK(vp);
 
 	return vp;
 }
fs/xfs/linux-2.4/xfs_vnode.h +1 -1
Index: linux/fs/xfs/linux-2.4/xfs_vnode.h
===================================================================
@@ -466,7 +466,7 @@ static inline struct bhv_vnode *vn_grab(
  * Vnode spinlock manipulation.
  */
 #define VN_LOCK(vp)		mutex_spinlock(&(vp)->v_lock)
-#define VN_UNLOCK(vp, s)	mutex_spinunlock(&(vp)->v_lock, s)
+#define VN_UNLOCK(vp)		mutex_spinunlock(&(vp)->v_lock)
 
 STATIC_INLINE void vn_flagset(struct bhv_vnode *vp, uint flag)
 {
fs/xfs/linux-2.6/spin.h +2 -5
Index: linux/fs/xfs/linux-2.6/spin.h
===================================================================
@@ -30,16 +30,13 @@
 
 typedef spinlock_t lock_t;
 
-#define SPLDECL(s)			unsigned long s
 #ifndef DEFINE_SPINLOCK
 #define DEFINE_SPINLOCK(s)		spinlock_t s = SPIN_LOCK_UNLOCKED
 #endif
 
 #define spinlock_init(lock, name)	spin_lock_init(lock)
 #define	spinlock_destroy(lock)
-#define mutex_spinlock(lock)		({ spin_lock(lock); 0; })
-#define mutex_spinunlock(lock, s)	do { spin_unlock(lock); (void)s; } while (0)
-#define nested_spinlock(lock)		spin_lock(lock)
-#define nested_spinunlock(lock)		spin_unlock(lock)
+#define mutex_spinlock(lock)		spin_lock(lock)
+#define mutex_spinunlock(lock)		spin_unlock(lock)
 
 #endif /* __XFS_SUPPORT_SPIN_H__ */
fs/xfs/linux-2.6/xfs_super.c +1 -1
Index: linux/fs/xfs/linux-2.6/xfs_super.c
===================================================================
@@ -447,7 +447,7 @@ xfs_fs_clear_inode(
 
 	VN_LOCK(vp);
 	vp->v_flag &= ~VMODIFIED;
-	VN_UNLOCK(vp, 0);
+	VN_UNLOCK(vp);
 
 	if (VNHEAD(vp))
 		if (bhv_vop_reclaim(vp))
fs/xfs/linux-2.6/xfs_vnode.c +1 -1
Index: linux/fs/xfs/linux-2.6/xfs_vnode.c
===================================================================
@@ -183,7 +183,7 @@ vn_hold(
 	VN_LOCK(vp);
 	inode = igrab(vn_to_inode(vp));
 	ASSERT(inode);
-	VN_UNLOCK(vp, 0);
+	VN_UNLOCK(vp);
 
 	return vp;
 }
fs/xfs/linux-2.6/xfs_vnode.h +1 -1
Index: linux/fs/xfs/linux-2.6/xfs_vnode.h
===================================================================
@@ -485,7 +485,7 @@ static inline struct bhv_vnode *vn_grab(
  * Vnode spinlock manipulation.
  */
 #define VN_LOCK(vp)		mutex_spinlock(&(vp)->v_lock)
-#define VN_UNLOCK(vp, s)	mutex_spinunlock(&(vp)->v_lock, s)
+#define VN_UNLOCK(vp)		mutex_spinunlock(&(vp)->v_lock)
 
 STATIC_INLINE void vn_flagset(struct bhv_vnode *vp, uint flag)
 {
fs/xfs/quota/xfs_dquot.c +5 -7
Index: linux/fs/xfs/quota/xfs_dquot.c
===================================================================
@@ -1209,7 +1209,6 @@ xfs_qm_dqflush(
 	xfs_buf_t		*bp;
 	xfs_disk_dquot_t	*ddqp;
 	int			error;
-	SPLDECL(s);
 
 	ASSERT(XFS_DQ_IS_LOCKED(dqp));
 	ASSERT(XFS_DQ_IS_FLUSH_LOCKED(dqp));
@@ -1270,9 +1269,9 @@ xfs_qm_dqflush(
 	mp = dqp->q_mount;
 
 	/* lsn is 64 bits */
-	AIL_LOCK(mp, s);
+	AIL_LOCK(mp);
 	dqp->q_logitem.qli_flush_lsn = dqp->q_logitem.qli_item.li_lsn;
-	AIL_UNLOCK(mp, s);
+	AIL_UNLOCK(mp);
 
 	/*
 	 * Attach an iodone routine so that we can remove this dquot from the
@@ -1318,7 +1317,6 @@ xfs_qm_dqflush_done(
 	xfs_dq_logitem_t	*qip)
 {
 	xfs_dquot_t		*dqp;
-	SPLDECL(s);
 
 	dqp = qip->qli_dquot;
 
@@ -1333,15 +1331,15 @@ xfs_qm_dqflush_done(
 	if ((qip->qli_item.li_flags & XFS_LI_IN_AIL) &&
 	    qip->qli_item.li_lsn == qip->qli_flush_lsn) {
 
-		AIL_LOCK(dqp->q_mount, s);
+		AIL_LOCK(dqp->q_mount);
 		/*
 		 * xfs_trans_delete_ail() drops the AIL lock.
 		 */
 		if (qip->qli_item.li_lsn == qip->qli_flush_lsn)
 			xfs_trans_delete_ail(dqp->q_mount,
-					     (xfs_log_item_t*)qip, s);
+					     (xfs_log_item_t*)qip);
 		else
-			AIL_UNLOCK(dqp->q_mount, s);
+			AIL_UNLOCK(dqp->q_mount);
 	}
 
 	/*
fs/xfs/quota/xfs_dquot.h +2 -2
Index: linux/fs/xfs/quota/xfs_dquot.h
===================================================================
@@ -125,8 +125,8 @@ XFS_DQ_IS_LOCKED(xfs_dquot_t *dqp)
 
 #define XFS_DQ_PINLOCK(dqp)	   mutex_spinlock( \
 				     &(XFS_DQ_TO_QINF(dqp)->qi_pinlock))
-#define XFS_DQ_PINUNLOCK(dqp, s)   mutex_spinunlock( \
-				     &(XFS_DQ_TO_QINF(dqp)->qi_pinlock), s)
+#define XFS_DQ_PINUNLOCK(dqp)      mutex_spinunlock( \
+				     &(XFS_DQ_TO_QINF(dqp)->qi_pinlock))
 
 #define XFS_DQ_IS_FLUSH_LOCKED(dqp) (issemalocked(&((dqp)->q_flock)))
 #define XFS_DQ_IS_ON_FREELIST(dqp)  ((dqp)->dq_flnext != (dqp))
fs/xfs/quota/xfs_dquot_item.c +8 -13
Index: linux/fs/xfs/quota/xfs_dquot_item.c
===================================================================
@@ -94,14 +94,13 @@ STATIC void
 xfs_qm_dquot_logitem_pin(
 	xfs_dq_logitem_t *logitem)
 {
-	unsigned long	s;
 	xfs_dquot_t *dqp;
 
 	dqp = logitem->qli_dquot;
 	ASSERT(XFS_DQ_IS_LOCKED(dqp));
-	s = XFS_DQ_PINLOCK(dqp);
+	XFS_DQ_PINLOCK(dqp);
 	dqp->q_pincount++;
-	XFS_DQ_PINUNLOCK(dqp, s);
+	XFS_DQ_PINUNLOCK(dqp);
 }
 
 /*
@@ -115,17 +114,16 @@ xfs_qm_dquot_logitem_unpin(
 	xfs_dq_logitem_t *logitem,
 	int		  stale)
 {
-	unsigned long	s;
 	xfs_dquot_t *dqp;
 
 	dqp = logitem->qli_dquot;
 	ASSERT(dqp->q_pincount > 0);
-	s = XFS_DQ_PINLOCK(dqp);
+	XFS_DQ_PINLOCK(dqp);
 	dqp->q_pincount--;
 	if (dqp->q_pincount == 0) {
 		sv_broadcast(&dqp->q_pinwait);
 	}
-	XFS_DQ_PINUNLOCK(dqp, s);
+	XFS_DQ_PINUNLOCK(dqp);
 }
 
 /* ARGSUSED */
@@ -189,8 +187,6 @@ void
 xfs_qm_dqunpin_wait(
 	xfs_dquot_t	*dqp)
 {
-	SPLDECL(s);
-
 	ASSERT(XFS_DQ_IS_LOCKED(dqp));
 	if (dqp->q_pincount == 0) {
 		return;
@@ -200,9 +196,9 @@ xfs_qm_dqunpin_wait(
 	 * Give the log a push so we don't wait here too long.
 	 */
 	xfs_log_force(dqp->q_mount, (xfs_lsn_t)0, XFS_LOG_FORCE);
-	s = XFS_DQ_PINLOCK(dqp);
+	XFS_DQ_PINLOCK(dqp);
 	if (dqp->q_pincount == 0) {
-		XFS_DQ_PINUNLOCK(dqp, s);
+		XFS_DQ_PINUNLOCK(dqp);
 		return;
 	}
 	sv_wait(&(dqp->q_pinwait), PINOD,
@@ -562,15 +558,14 @@ xfs_qm_qoffend_logitem_committed(
 	xfs_lsn_t lsn)
 {
 	xfs_qoff_logitem_t	*qfs;
-	SPLDECL(s);
 
 	qfs = qfe->qql_start_lip;
-	AIL_LOCK(qfs->qql_item.li_mountp,s);
+	AIL_LOCK(qfs->qql_item.li_mountp);
 	/*
 	 * Delete the qoff-start logitem from the AIL.
 	 * xfs_trans_delete_ail() drops the AIL lock.
 	 */
-	xfs_trans_delete_ail(qfs->qql_item.li_mountp, (xfs_log_item_t *)qfs, s);
+	xfs_trans_delete_ail(qfs->qql_item.li_mountp, (xfs_log_item_t *)qfs);
 	kmem_free(qfs, sizeof(xfs_qoff_logitem_t));
 	kmem_free(qfe, sizeof(xfs_qoff_logitem_t));
 	return (xfs_lsn_t)-1;
fs/xfs/quota/xfs_qm.c +4 -6
Index: linux/fs/xfs/quota/xfs_qm.c
===================================================================
@@ -344,7 +344,6 @@ xfs_qm_mount_quotas(
 	xfs_mount_t	*mp,
 	int		mfsi_flags)
 {
-	unsigned long	s;
 	int		error = 0;
 	uint		sbf;
 
@@ -404,10 +403,10 @@ xfs_qm_mount_quotas(
 	 * We actually don't have to acquire the SB_LOCK at all.
 	 * This can only be called from mount, and that's single threaded. XXX
 	 */
-	s = XFS_SB_LOCK(mp);
+	XFS_SB_LOCK(mp);
 	sbf = mp->m_sb.sb_qflags;
 	mp->m_sb.sb_qflags = mp->m_qflags & XFS_MOUNT_QUOTA_ALL;
-	XFS_SB_UNLOCK(mp, s);
+	XFS_SB_UNLOCK(mp);
 
 	if (sbf != (mp->m_qflags & XFS_MOUNT_QUOTA_ALL)) {
 		if (xfs_qm_write_sb_changes(mp, XFS_SB_QFLAGS)) {
@@ -1401,7 +1400,6 @@ xfs_qm_qino_alloc(
 {
 	xfs_trans_t	*tp;
 	int		error;
-	unsigned long	s;
 	int		committed;
 
 	tp = xfs_trans_alloc(mp, XFS_TRANS_QM_QINOCREATE);
@@ -1433,7 +1431,7 @@ xfs_qm_qino_alloc(
 	 * sbfields arg may contain fields other than *QUOTINO;
 	 * VERSIONNUM for example.
 	 */
-	s = XFS_SB_LOCK(mp);
+	XFS_SB_LOCK(mp);
 	if (flags & XFS_QMOPT_SBVERSION) {
 #if defined(DEBUG) && defined(XFS_LOUD_RECOVERY)
 		unsigned oldv = mp->m_sb.sb_versionnum;
@@ -1460,7 +1458,7 @@ xfs_qm_qino_alloc(
 		mp->m_sb.sb_uquotino = (*ip)->i_ino;
 	else
 		mp->m_sb.sb_gquotino = (*ip)->i_ino;
-	XFS_SB_UNLOCK(mp, s);
+	XFS_SB_UNLOCK(mp);
 	xfs_mod_sb(tp, sbfields);
 
 	if ((error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES))) {
fs/xfs/quota/xfs_qm_syscalls.c +8 -11
Index: linux/fs/xfs/quota/xfs_qm_syscalls.c
===================================================================
@@ -205,7 +205,6 @@ xfs_qm_scall_quotaoff(
 	boolean_t		force)
 {
 	uint			dqtype;
-	unsigned long	s;
 	int			error;
 	uint			inactivate_flags;
 	xfs_qoff_logitem_t	*qoffstart;
@@ -242,9 +241,9 @@ xfs_qm_scall_quotaoff(
 	if ((flags & XFS_ALL_QUOTA_ACCT) == 0) {
 		mp->m_qflags &= ~(flags);
 
-		s = XFS_SB_LOCK(mp);
+		XFS_SB_LOCK(mp);
 		mp->m_sb.sb_qflags = mp->m_qflags;
-		XFS_SB_UNLOCK(mp, s);
+		XFS_SB_UNLOCK(mp);
 		mutex_unlock(&(XFS_QI_QOFFLOCK(mp)));
 
 		/* XXX what to do if error ? Revert back to old vals incore ? */
@@ -420,7 +419,6 @@ xfs_qm_scall_quotaon(
 	uint		flags)
 {
 	int		error;
-	unsigned long	s;
 	uint		qf;
 	uint		accflags;
 	__int64_t	sbflags;
@@ -473,10 +471,10 @@ xfs_qm_scall_quotaon(
 	 * Change sb_qflags on disk but not incore mp->qflags
 	 * if this is the root filesystem.
 	 */
-	s = XFS_SB_LOCK(mp);
+	XFS_SB_LOCK(mp);
 	qf = mp->m_sb.sb_qflags;
 	mp->m_sb.sb_qflags = qf | flags;
-	XFS_SB_UNLOCK(mp, s);
+	XFS_SB_UNLOCK(mp);
 
 	/*
 	 * There's nothing to change if it's the same.
@@ -820,7 +818,6 @@ xfs_qm_log_quotaoff(
 {
 	xfs_trans_t	       *tp;
 	int			error;
-	unsigned long	s;
 	xfs_qoff_logitem_t     *qoffi=NULL;
 	uint			oldsbqflag=0;
 
@@ -837,10 +834,10 @@ xfs_qm_log_quotaoff(
 	qoffi = xfs_trans_get_qoff_item(tp, NULL, flags & XFS_ALL_QUOTA_ACCT);
 	xfs_trans_log_quotaoff_item(tp, qoffi);
 
-	s = XFS_SB_LOCK(mp);
+	XFS_SB_LOCK(mp);
 	oldsbqflag = mp->m_sb.sb_qflags;
 	mp->m_sb.sb_qflags = (mp->m_qflags & ~(flags)) & XFS_MOUNT_QUOTA_ALL;
-	XFS_SB_UNLOCK(mp, s);
+	XFS_SB_UNLOCK(mp);
 
 	xfs_mod_sb(tp, XFS_SB_QFLAGS);
 
@@ -859,9 +856,9 @@ error0:
 		 * No one else is modifying sb_qflags, so this is OK.
 		 * We still hold the quotaofflock.
 		 */
-		s = XFS_SB_LOCK(mp);
+		XFS_SB_LOCK(mp);
 		mp->m_sb.sb_qflags = oldsbqflag;
-		XFS_SB_UNLOCK(mp, s);
+		XFS_SB_UNLOCK(mp);
 	}
 	*qoffstartp = qoffi;
 	return (error);
fs/xfs/xfs_alloc.c +7 -10
Index: linux/fs/xfs/xfs_alloc.c
===================================================================
@@ -2500,10 +2500,9 @@ xfs_alloc_mark_busy(xfs_trans_t *tp,
 	xfs_mount_t		*mp;
 	xfs_perag_busy_t	*bsy;
 	int			n;
-	SPLDECL(s);
 
 	mp = tp->t_mountp;
-	s = mutex_spinlock(&mp->m_perag[agno].pagb_lock);
+	mutex_spinlock(&mp->m_perag[agno].pagb_lock);
 
 	/* search pagb_list for an open slot */
 	for (bsy = mp->m_perag[agno].pagb_list, n = 0;
@@ -2533,7 +2532,7 @@ xfs_alloc_mark_busy(xfs_trans_t *tp,
 		xfs_trans_set_sync(tp);
 	}
 
-	mutex_spinunlock(&mp->m_perag[agno].pagb_lock, s);
+	mutex_spinunlock(&mp->m_perag[agno].pagb_lock);
 }
 
 void
@@ -2543,11 +2542,10 @@ xfs_alloc_clear_busy(xfs_trans_t *tp,
 {
 	xfs_mount_t		*mp;
 	xfs_perag_busy_t	*list;
-	SPLDECL(s);
 
 	mp = tp->t_mountp;
 
-	s = mutex_spinlock(&mp->m_perag[agno].pagb_lock);
+	mutex_spinlock(&mp->m_perag[agno].pagb_lock);
 	list = mp->m_perag[agno].pagb_list;
 
 	ASSERT(idx < XFS_PAGB_NUM_SLOTS);
@@ -2559,7 +2557,7 @@ xfs_alloc_clear_busy(xfs_trans_t *tp,
 		TRACE_UNBUSY("xfs_alloc_clear_busy", "missing", agno, idx, tp);
 	}
 
-	mutex_spinunlock(&mp->m_perag[agno].pagb_lock, s);
+	mutex_spinunlock(&mp->m_perag[agno].pagb_lock);
 }
 
 
@@ -2578,11 +2576,10 @@ xfs_alloc_search_busy(xfs_trans_t *tp,
 	xfs_agblock_t		uend, bend;
 	xfs_lsn_t		lsn;
 	int			cnt;
-	SPLDECL(s);
 
 	mp = tp->t_mountp;
 
-	s = mutex_spinlock(&mp->m_perag[agno].pagb_lock);
+	mutex_spinlock(&mp->m_perag[agno].pagb_lock);
 	cnt = mp->m_perag[agno].pagb_count;
 
 	uend = bno + len - 1;
@@ -2615,12 +2612,12 @@ xfs_alloc_search_busy(xfs_trans_t *tp,
 	if (cnt) {
 		TRACE_BUSYSEARCH("xfs_alloc_search_busy", "found", agno, bno, len, n, tp);
 		lsn = bsy->busy_tp->t_commit_lsn;
-		mutex_spinunlock(&mp->m_perag[agno].pagb_lock, s);
+		mutex_spinunlock(&mp->m_perag[agno].pagb_lock);
 		xfs_log_force(mp, lsn, XFS_LOG_FORCE|XFS_LOG_SYNC);
 	} else {
 		TRACE_BUSYSEARCH("xfs_alloc_search_busy", "not-found", agno, bno, len, n, tp);
 		n = -1;
-		mutex_spinunlock(&mp->m_perag[agno].pagb_lock, s);
+		mutex_spinunlock(&mp->m_perag[agno].pagb_lock);
 	}
 
 	return n;
fs/xfs/xfs_attr_leaf.c +3 -5
Index: linux/fs/xfs/xfs_attr_leaf.c
===================================================================
@@ -226,17 +226,15 @@ xfs_attr_shortform_bytesfit(xfs_inode_t 
 STATIC void
 xfs_sbversion_add_attr2(xfs_mount_t *mp, xfs_trans_t *tp)
 {
-	unsigned long s;
-
 	if ((mp->m_flags & XFS_MOUNT_ATTR2) &&
 	    !(XFS_SB_VERSION_HASATTR2(&mp->m_sb))) {
-		s = XFS_SB_LOCK(mp);
+		XFS_SB_LOCK(mp);
 		if (!XFS_SB_VERSION_HASATTR2(&mp->m_sb)) {
 			XFS_SB_VERSION_ADDATTR2(&mp->m_sb);
-			XFS_SB_UNLOCK(mp, s);
+			XFS_SB_UNLOCK(mp);
 			xfs_mod_sb(tp, XFS_SB_VERSIONNUM | XFS_SB_FEATURES2);
 		} else
-			XFS_SB_UNLOCK(mp, s);
+			XFS_SB_UNLOCK(mp);
 	}
 }
 
fs/xfs/xfs_bmap.c +3 -4
Index: linux/fs/xfs/xfs_bmap.c
===================================================================
@@ -3970,7 +3970,6 @@ xfs_bmap_add_attrfork(
 	xfs_bmap_free_t		flist;		/* freed extent records */
 	xfs_mount_t		*mp;		/* mount structure */
 	xfs_trans_t		*tp;		/* transaction pointer */
-	unsigned long		s;		/* spinlock spl value */
 	int			blks;		/* space reservation */
 	int			version = 1;	/* superblock attr version */
 	int			committed;	/* xaction was committed */
@@ -4067,7 +4066,7 @@ xfs_bmap_add_attrfork(
 	   (!XFS_SB_VERSION_HASATTR2(&mp->m_sb) && version == 2)) {
 		__int64_t sbfields = 0;
 
-		s = XFS_SB_LOCK(mp);
+		XFS_SB_LOCK(mp);
 		if (!XFS_SB_VERSION_HASATTR(&mp->m_sb)) {
 			XFS_SB_VERSION_ADDATTR(&mp->m_sb);
 			sbfields |= XFS_SB_VERSIONNUM;
@@ -4077,10 +4076,10 @@ xfs_bmap_add_attrfork(
 			sbfields |= (XFS_SB_VERSIONNUM | XFS_SB_FEATURES2);
 		}
 		if (sbfields) {
-			XFS_SB_UNLOCK(mp, s);
+			XFS_SB_UNLOCK(mp);
 			xfs_mod_sb(tp, sbfields);
 		} else
-			XFS_SB_UNLOCK(mp, s);
+			XFS_SB_UNLOCK(mp);
 	}
 	if ((error = xfs_bmap_finish(&tp, &flist, &committed)))
 		goto error2;
fs/xfs/xfs_buf_item.c +4 -6
Index: linux/fs/xfs/xfs_buf_item.c
===================================================================
@@ -377,7 +377,6 @@ xfs_buf_item_unpin(
 	xfs_mount_t	*mp;
 	xfs_buf_t	*bp;
 	int		freed;
-	SPLDECL(s);
 
 	bp = bip->bli_buf;
 	ASSERT(bp != NULL);
@@ -408,8 +407,8 @@ xfs_buf_item_unpin(
 			XFS_BUF_SET_FSPRIVATE(bp, NULL);
 			XFS_BUF_CLR_IODONE_FUNC(bp);
 		} else {
-			AIL_LOCK(mp,s);
-			xfs_trans_delete_ail(mp, (xfs_log_item_t *)bip, s);
+			AIL_LOCK(mp);
+			xfs_trans_delete_ail(mp, (xfs_log_item_t *)bip);
 			xfs_buf_item_relse(bp);
 			ASSERT(XFS_BUF_FSPRIVATE(bp, void *) == NULL);
 		}
@@ -1112,7 +1111,6 @@ xfs_buf_iodone(
 	xfs_buf_log_item_t	*bip)
 {
 	struct xfs_mount	*mp;
-	SPLDECL(s);
 
 	ASSERT(bip->bli_buf == bp);
 
@@ -1127,11 +1125,11 @@ xfs_buf_iodone(
 	 *
 	 * Either way, AIL is useless if we're forcing a shutdown.
 	 */
-	AIL_LOCK(mp,s);
+	AIL_LOCK(mp);
 	/*
 	 * xfs_trans_delete_ail() drops the AIL lock.
 	 */
-	xfs_trans_delete_ail(mp, (xfs_log_item_t *)bip, s);
+	xfs_trans_delete_ail(mp, (xfs_log_item_t *)bip);
 
 #ifdef XFS_TRANS_DEBUG
 	kmem_free(bip->bli_orig, XFS_BUF_COUNT(bp));
fs/xfs/xfs_da_btree.c +4 -7
Index: linux/fs/xfs/xfs_da_btree.c
===================================================================
@@ -2265,10 +2265,9 @@ xfs_da_buf_make(int nbuf, xfs_buf_t **bp
 	}
 #ifdef XFS_DABUF_DEBUG
 	{
-		SPLDECL(s);
 		xfs_dabuf_t	*p;
 
-		s = mutex_spinlock(&xfs_dabuf_global_lock);
+		mutex_spinlock(&xfs_dabuf_global_lock);
 		for (p = xfs_dabuf_global_list; p; p = p->next) {
 			ASSERT(p->blkno != dabuf->blkno ||
 			       p->target != dabuf->target);
@@ -2278,7 +2277,7 @@ xfs_da_buf_make(int nbuf, xfs_buf_t **bp
 			xfs_dabuf_global_list->prev = dabuf;
 		dabuf->next = xfs_dabuf_global_list;
 		xfs_dabuf_global_list = dabuf;
-		mutex_spinunlock(&xfs_dabuf_global_lock, s);
+		mutex_spinunlock(&xfs_dabuf_global_lock);
 	}
 #endif
 	return dabuf;
@@ -2320,16 +2319,14 @@ xfs_da_buf_done(xfs_dabuf_t *dabuf)
 		kmem_free(dabuf->data, BBTOB(dabuf->bbcount));
 #ifdef XFS_DABUF_DEBUG
 	{
-		SPLDECL(s);
-
-		s = mutex_spinlock(&xfs_dabuf_global_lock);
+		mutex_spinlock(&xfs_dabuf_global_lock);
 		if (dabuf->prev)
 			dabuf->prev->next = dabuf->next;
 		else
 			xfs_dabuf_global_list = dabuf->next;
 		if (dabuf->next)
 			dabuf->next->prev = dabuf->prev;
-		mutex_spinunlock(&xfs_dabuf_global_lock, s);
+		mutex_spinunlock(&xfs_dabuf_global_lock);
 	}
 	memset(dabuf, 0, XFS_DA_BUF_SIZE(dabuf->nbuf));
 #endif
fs/xfs/xfs_extfree_item.c +9 -12
Index: linux/fs/xfs/xfs_extfree_item.c
===================================================================
@@ -109,19 +109,18 @@ STATIC void
 xfs_efi_item_unpin(xfs_efi_log_item_t *efip, int stale)
 {
 	xfs_mount_t	*mp;
-	SPLDECL(s);
 
 	mp = efip->efi_item.li_mountp;
-	AIL_LOCK(mp, s);
+	AIL_LOCK(mp);
 	if (efip->efi_flags & XFS_EFI_CANCELED) {
 		/*
 		 * xfs_trans_delete_ail() drops the AIL lock.
 		 */
-		xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip, s);
+		xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip);
 		xfs_efi_item_free(efip);
 	} else {
 		efip->efi_flags |= XFS_EFI_COMMITTED;
-		AIL_UNLOCK(mp, s);
+		AIL_UNLOCK(mp);
 	}
 }
 
@@ -137,10 +136,9 @@ xfs_efi_item_unpin_remove(xfs_efi_log_it
 {
 	xfs_mount_t	*mp;
 	xfs_log_item_desc_t	*lidp;
-	SPLDECL(s);
 
 	mp = efip->efi_item.li_mountp;
-	AIL_LOCK(mp, s);
+	AIL_LOCK(mp);
 	if (efip->efi_flags & XFS_EFI_CANCELED) {
 		/*
 		 * free the xaction descriptor pointing to this item
@@ -151,11 +149,11 @@ xfs_efi_item_unpin_remove(xfs_efi_log_it
 		 * pull the item off the AIL.
 		 * xfs_trans_delete_ail() drops the AIL lock.
 		 */
-		xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip, s);
+		xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip);
 		xfs_efi_item_free(efip);
 	} else {
 		efip->efi_flags |= XFS_EFI_COMMITTED;
-		AIL_UNLOCK(mp, s);
+		AIL_UNLOCK(mp);
 	}
 }
 
@@ -349,13 +347,12 @@ xfs_efi_release(xfs_efi_log_item_t	*efip
 {
 	xfs_mount_t	*mp;
 	int		extents_left;
-	SPLDECL(s);
 
 	mp = efip->efi_item.li_mountp;
 	ASSERT(efip->efi_next_extent > 0);
 	ASSERT(efip->efi_flags & XFS_EFI_COMMITTED);
 
-	AIL_LOCK(mp, s);
+	AIL_LOCK(mp);
 	ASSERT(efip->efi_next_extent >= nextents);
 	efip->efi_next_extent -= nextents;
 	extents_left = efip->efi_next_extent;
@@ -363,10 +360,10 @@ xfs_efi_release(xfs_efi_log_item_t	*efip
 		/*
 		 * xfs_trans_delete_ail() drops the AIL lock.
 		 */
-		xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip, s);
+		xfs_trans_delete_ail(mp, (xfs_log_item_t *)efip);
 		xfs_efi_item_free(efip);
 	} else {
-		AIL_UNLOCK(mp, s);
+		AIL_UNLOCK(mp);
 	}
 }
 
fs/xfs/xfs_fsops.c +4 -7
Index: linux/fs/xfs/xfs_fsops.c
===================================================================
@@ -464,15 +464,13 @@ xfs_fs_counts(
 	xfs_mount_t		*mp,
 	xfs_fsop_counts_t	*cnt)
 {
-	unsigned long	s;
-
 	xfs_icsb_sync_counters_flags(mp, XFS_ICSB_LAZY_COUNT);
-	s = XFS_SB_LOCK(mp);
+	XFS_SB_LOCK(mp);
 	cnt->freedata = mp->m_sb.sb_fdblocks - XFS_ALLOC_SET_ASIDE(mp);
 	cnt->freertx = mp->m_sb.sb_frextents;
 	cnt->freeino = mp->m_sb.sb_ifree;
 	cnt->allocino = mp->m_sb.sb_icount;
-	XFS_SB_UNLOCK(mp, s);
+	XFS_SB_UNLOCK(mp);
 	return 0;
 }
 
@@ -499,7 +497,6 @@ xfs_reserve_blocks(
 {
 	__int64_t		lcounter, delta, fdblks_delta;
 	__uint64_t		request;
-	unsigned long		s;
 
 	/* If inval is null, report current values and return */
 	if (inval == (__uint64_t *)NULL) {
@@ -528,7 +525,7 @@ xfs_reserve_blocks(
 	 * enabled, disabled or even compiled in....
 	 */
 retry:
-	s = XFS_SB_LOCK(mp);
+	XFS_SB_LOCK(mp);
 	xfs_icsb_sync_counters_flags(mp, XFS_ICSB_SB_LOCKED);
 
 	/*
@@ -571,7 +568,7 @@ out:
 		outval->resblks = mp->m_resblks;
 		outval->resblks_avail = mp->m_resblks_avail;
 	}
-	XFS_SB_UNLOCK(mp, s);
+	XFS_SB_UNLOCK(mp);
 
 	if (fdblks_delta) {
 		/*
fs/xfs/xfs_iget.c +5 -7
Index: linux/fs/xfs/xfs_iget.c
===================================================================
@@ -201,7 +201,6 @@ xfs_iget_core(
 	/* REFERENCED */
 	xfs_chash_t	*ch;
 	xfs_chashlist_t	*chl, *chlnew;
-	SPLDECL(s);
 
 
 	ih = XFS_IHASH(mp, ino);
@@ -408,7 +407,7 @@ finish_inode:
 	chlnew = NULL;
 	ch = XFS_CHASH(mp, ip->i_blkno);
  chlredo:
-	s = mutex_spinlock(&ch->ch_lock);
+	mutex_spinlock(&ch->ch_lock);
 	for (chl = ch->ch_list; chl != NULL; chl = chl->chl_next) {
 		if (chl->chl_blkno == ip->i_blkno) {
 
@@ -432,7 +431,7 @@ finish_inode:
 	/* no hash list found for this block; add a new hash list */
 	if (chl == NULL)  {
 		if (chlnew == NULL) {
-			mutex_spinunlock(&ch->ch_lock, s);
+			mutex_spinunlock(&ch->ch_lock);
 			ASSERT(xfs_chashlist_zone != NULL);
 			chlnew = (xfs_chashlist_t *)
 					kmem_zone_alloc(xfs_chashlist_zone,
@@ -458,7 +457,7 @@ finish_inode:
 		}
 	}
 
-	mutex_spinunlock(&ch->ch_lock, s);
+	mutex_spinunlock(&ch->ch_lock);
 
 
 	/*
@@ -723,7 +722,6 @@ xfs_iextract(
 	xfs_mount_t	*mp;
 	xfs_chash_t	*ch;
 	xfs_chashlist_t *chl, *chm;
-	SPLDECL(s);
 
 	ih = ip->i_hash;
 	write_lock(&ih->ih_lock);
@@ -742,7 +740,7 @@ xfs_iextract(
 	 */
 	mp = ip->i_mount;
 	ch = XFS_CHASH(mp, ip->i_blkno);
-	s = mutex_spinlock(&ch->ch_lock);
+	mutex_spinlock(&ch->ch_lock);
 
 	if (ip->i_cnext == ip) {
 		/* Last inode on chashlist */
@@ -769,7 +767,7 @@ xfs_iextract(
 		ip->i_cprev = __return_address;
 		ip->i_cnext = __return_address;
 	}
-	mutex_spinunlock(&ch->ch_lock, s);
+	mutex_spinunlock(&ch->ch_lock);
 
 	/*
 	 * Remove from mount's inode list.
fs/xfs/xfs_inode.c +12 -16
Index: linux/fs/xfs/xfs_inode.c
===================================================================
@@ -2193,7 +2193,6 @@ xfs_ifree_cluster(
 	xfs_inode_t		*ip, **ip_found;
 	xfs_inode_log_item_t	*iip;
 	xfs_log_item_t		*lip;
-	SPLDECL(s);
 
 	if (mp->m_sb.sb_blocksize >= XFS_INODE_CLUSTER_SIZE(mp)) {
 		blks_per_cluster = 1;
@@ -2299,9 +2298,9 @@ xfs_ifree_cluster(
 				iip = (xfs_inode_log_item_t *)lip;
 				ASSERT(iip->ili_logged == 1);
 				lip->li_cb = (void(*)(xfs_buf_t*,xfs_log_item_t*)) xfs_istale_done;
-				AIL_LOCK(mp,s);
+				AIL_LOCK(mp);
 				iip->ili_flush_lsn = iip->ili_item.li_lsn;
-				AIL_UNLOCK(mp, s);
+				AIL_UNLOCK(mp);
 				xfs_iflags_set(iip->ili_inode, XFS_ISTALE);
 				pre_flushed++;
 			}
@@ -2322,9 +2321,9 @@ xfs_ifree_cluster(
 			iip->ili_last_fields = iip->ili_format.ilf_fields;
 			iip->ili_format.ilf_fields = 0;
 			iip->ili_logged = 1;
-			AIL_LOCK(mp,s);
+			AIL_LOCK(mp);
 			iip->ili_flush_lsn = iip->ili_item.li_lsn;
-			AIL_UNLOCK(mp, s);
+			AIL_UNLOCK(mp);
 
 			xfs_buf_attach_iodone(bp,
 				(void(*)(xfs_buf_t*,xfs_log_item_t*))
@@ -2758,16 +2757,15 @@ xfs_idestroy(
 		 */
 		xfs_mount_t	*mp = ip->i_mount;
 		xfs_log_item_t	*lip = &ip->i_itemp->ili_item;
-		int		s;
 
 		ASSERT(((lip->li_flags & XFS_LI_IN_AIL) == 0) ||
 				       XFS_FORCED_SHUTDOWN(ip->i_mount));
 		if (lip->li_flags & XFS_LI_IN_AIL) {
-			AIL_LOCK(mp, s);
+			AIL_LOCK(mp);
 			if (lip->li_flags & XFS_LI_IN_AIL)
-				xfs_trans_delete_ail(mp, lip, s);
+				xfs_trans_delete_ail(mp, lip);
 			else
-				AIL_UNLOCK(mp, s);
+				AIL_UNLOCK(mp);
 		}
 		xfs_inode_item_destroy(ip);
 	}
@@ -3067,7 +3065,6 @@ xfs_iflush(
 	int			clcount;	/* count of inodes clustered */
 	int			bufwasdelwri;
 	enum { INT_DELWRI = (1 << 0), INT_ASYNC = (1 << 1) };
-	SPLDECL(s);
 
 	XFS_STATS_INC(xs_iflush_count);
 
@@ -3185,7 +3182,7 @@ xfs_iflush(
 	ip->i_chash->chl_buf = bp;
 
 	ch = XFS_CHASH(mp, ip->i_blkno);
-	s = mutex_spinlock(&ch->ch_lock);
+	mutex_spinlock(&ch->ch_lock);
 
 	clcount = 0;
 	for (iq = ip->i_cnext; iq != ip; iq = iq->i_cnext) {
@@ -3239,7 +3236,7 @@ xfs_iflush(
 			xfs_iunlock(iq, XFS_ILOCK_SHARED);
 		}
 	}
-	mutex_spinunlock(&ch->ch_lock, s);
+	mutex_spinunlock(&ch->ch_lock);
 
 	if (clcount) {
 		XFS_STATS_INC(xs_icluster_flushcnt);
@@ -3276,7 +3273,7 @@ cluster_corrupt_out:
 	/* Corruption detected in the clustering loop.  Invalidate the
 	 * inode buffer and shut down the filesystem.
 	 */
-	mutex_spinunlock(&ch->ch_lock, s);
+	mutex_spinunlock(&ch->ch_lock);
 
 	/*
 	 * Clean up the buffer.  If it was B_DELWRI, just release it --
@@ -3327,7 +3324,6 @@ xfs_iflush_int(
 #ifdef XFS_TRANS_DEBUG
 	int			first;
 #endif
-	SPLDECL(s);
 
 	ASSERT(ismrlocked(&ip->i_lock, MR_UPDATE|MR_ACCESS));
 	ASSERT(issemalocked(&(ip->i_flock)));
@@ -3522,9 +3518,9 @@ xfs_iflush_int(
 		iip->ili_logged = 1;
 
 		ASSERT(sizeof(xfs_lsn_t) == 8);	/* don't lock if it shrinks */
-		AIL_LOCK(mp,s);
+		AIL_LOCK(mp);
 		iip->ili_flush_lsn = iip->ili_item.li_lsn;
-		AIL_UNLOCK(mp, s);
+		AIL_UNLOCK(mp);
 
 		/*
 		 * Attach the function xfs_iflush_done to the inode's
fs/xfs/xfs_inode_item.c +6 -9
Index: linux/fs/xfs/xfs_inode_item.c
===================================================================
@@ -968,7 +968,6 @@ xfs_iflush_done(
 	xfs_inode_log_item_t	*iip)
 {
 	xfs_inode_t	*ip;
-	SPLDECL(s);
 
 	ip = iip->ili_inode;
 
@@ -983,15 +982,15 @@ xfs_iflush_done(
 	 */
 	if (iip->ili_logged &&
 	    (iip->ili_item.li_lsn == iip->ili_flush_lsn)) {
-		AIL_LOCK(ip->i_mount, s);
+		AIL_LOCK(ip->i_mount);
 		if (iip->ili_item.li_lsn == iip->ili_flush_lsn) {
 			/*
 			 * xfs_trans_delete_ail() drops the AIL lock.
 			 */
 			xfs_trans_delete_ail(ip->i_mount,
-					     (xfs_log_item_t*)iip, s);
+					     (xfs_log_item_t*)iip);
 		} else {
-			AIL_UNLOCK(ip->i_mount, s);
+			AIL_UNLOCK(ip->i_mount);
 		}
 	}
 
@@ -1025,21 +1024,19 @@ xfs_iflush_abort(
 {
 	xfs_inode_log_item_t	*iip;
 	xfs_mount_t		*mp;
-	SPLDECL(s);
 
 	iip = ip->i_itemp;
 	mp = ip->i_mount;
 	if (iip) {
 		if (iip->ili_item.li_flags & XFS_LI_IN_AIL) {
-			AIL_LOCK(mp, s);
+			AIL_LOCK(mp);
 			if (iip->ili_item.li_flags & XFS_LI_IN_AIL) {
 				/*
 				 * xfs_trans_delete_ail() drops the AIL lock.
 				 */
-				xfs_trans_delete_ail(mp, (xfs_log_item_t *)iip,
-					s);
+				xfs_trans_delete_ail(mp, (xfs_log_item_t *)iip);
 			} else
-				AIL_UNLOCK(mp, s);
+				AIL_UNLOCK(mp);
 		}
 		iip->ili_logged = 0;
 		/*
fs/xfs/xfs_log.c +97 -127

805 lines not on this page · raw message

fs/xfs/xfs_log_priv.h +2 -2
Index: linux/fs/xfs/xfs_log_priv.h
===================================================================
@@ -106,9 +106,9 @@ struct xfs_mount;
 #endif
 
 #define GRANT_LOCK(log)		mutex_spinlock(&(log)->l_grant_lock)
-#define GRANT_UNLOCK(log, s)	mutex_spinunlock(&(log)->l_grant_lock, s)
+#define GRANT_UNLOCK(log)	mutex_spinunlock(&(log)->l_grant_lock)
 #define LOG_LOCK(log)		mutex_spinlock(&(log)->l_icloglock)
-#define LOG_UNLOCK(log, s)	mutex_spinunlock(&(log)->l_icloglock, s)
+#define LOG_UNLOCK(log)		mutex_spinunlock(&(log)->l_icloglock)
 
 #define xlog_panic(args...)	cmn_err(CE_PANIC, ## args)
 #define xlog_exit(args...)	cmn_err(CE_PANIC, ## args)
fs/xfs/xfs_log_recover.c +9 -12
Index: linux/fs/xfs/xfs_log_recover.c
===================================================================
@@ -2663,7 +2663,6 @@ xlog_recover_do_efi_trans(
 	xfs_mount_t		*mp;
 	xfs_efi_log_item_t	*efip;
 	xfs_efi_log_format_t	*efi_formatp;
-	SPLDECL(s);
 
 	if (pass == XLOG_RECOVER_PASS1) {
 		return 0;
@@ -2681,11 +2680,11 @@ xlog_recover_do_efi_trans(
 	efip->efi_next_extent = efi_formatp->efi_nextents;
 	efip->efi_flags |= XFS_EFI_COMMITTED;
 
-	AIL_LOCK(mp,s);
+	AIL_LOCK(mp);
 	/*
 	 * xfs_trans_update_ail() drops the AIL lock.
 	 */
-	xfs_trans_update_ail(mp, (xfs_log_item_t *)efip, lsn, s);
+	xfs_trans_update_ail(mp, (xfs_log_item_t *)efip, lsn);
 	return 0;
 }
 
@@ -2710,7 +2709,6 @@ xlog_recover_do_efd_trans(
 	xfs_log_item_t		*lip;
 	int			gen;
 	__uint64_t		efi_id;
-	SPLDECL(s);
 
 	if (pass == XLOG_RECOVER_PASS1) {
 		return;
@@ -2728,7 +2726,7 @@ xlog_recover_do_efd_trans(
 	 * in the AIL.
 	 */
 	mp = log->l_mp;
-	AIL_LOCK(mp,s);
+	AIL_LOCK(mp);
 	lip = xfs_trans_first_ail(mp, &gen);
 	while (lip != NULL) {
 		if (lip->li_type == XFS_LI_EFI) {
@@ -2738,7 +2736,7 @@ xlog_recover_do_efd_trans(
 				 * xfs_trans_delete_ail() drops the
 				 * AIL lock.
 				 */
-				xfs_trans_delete_ail(mp, lip, s);
+				xfs_trans_delete_ail(mp, lip);
 				break;
 			}
 		}
@@ -2752,7 +2750,7 @@ xlog_recover_do_efd_trans(
 	if (lip != NULL) {
 		xfs_efi_item_free(efip);
 	} else {
-		AIL_UNLOCK(mp, s);
+		AIL_UNLOCK(mp);
 	}
 }
 
@@ -3078,10 +3076,9 @@ xlog_recover_process_efis(
 	xfs_efi_log_item_t	*efip;
 	int			gen;
 	xfs_mount_t		*mp;
-	SPLDECL(s);
 
 	mp = log->l_mp;
-	AIL_LOCK(mp,s);
+	AIL_LOCK(mp);
 
 	lip = xfs_trans_first_ail(mp, &gen);
 	while (lip != NULL) {
@@ -3102,12 +3099,12 @@ xlog_recover_process_efis(
 			continue;
 		}
 
-		AIL_UNLOCK(mp, s);
+		AIL_UNLOCK(mp);
 		xlog_recover_process_efi(mp, efip);
-		AIL_LOCK(mp,s);
+		AIL_LOCK(mp);
 		lip = xfs_trans_next_ail(mp, lip, &gen, NULL);
 	}
-	AIL_UNLOCK(mp, s);
+	AIL_UNLOCK(mp);
 }
 
 /*
fs/xfs/xfs_mount.c +19 -25

170 lines not on this page · raw message

fs/xfs/xfs_mount.h +3 -3
Index: linux/fs/xfs/xfs_mount.h
===================================================================
@@ -74,8 +74,8 @@ extern struct bhv_vnodeops xfs_vnodeops;
 #define	AIL_LOCK_T		lock_t
 #define	AIL_LOCKINIT(x,y)	spinlock_init(x,y)
 #define	AIL_LOCK_DESTROY(x)	spinlock_destroy(x)
-#define	AIL_LOCK(mp,s)		s=mutex_spinlock(&(mp)->m_ail_lock)
-#define	AIL_UNLOCK(mp,s)	mutex_spinunlock(&(mp)->m_ail_lock, s)
+#define	AIL_LOCK(mp)		mutex_spinlock(&(mp)->m_ail_lock)
+#define	AIL_UNLOCK(mp)		mutex_spinunlock(&(mp)->m_ail_lock)
 
 
 /*
@@ -603,7 +603,7 @@ typedef struct xfs_mod_sb {
 #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))
+#define	XFS_SB_UNLOCK(mp)	mutex_spinunlock(&(mp)->m_sb_lock)
 
 extern xfs_mount_t *xfs_mount_init(void);
 extern void	xfs_mod_sb(xfs_trans_t *, __int64_t);
fs/xfs/xfs_mru_cache.c +9 -9
Index: linux/fs/xfs/xfs_mru_cache.c
===================================================================
@@ -242,7 +242,7 @@ _xfs_mru_cache_clear_reap_list(
 		 */
 		list_move(&elem->list_node, &tmp);
 	}
-	mutex_spinunlock(&mru->lock, 0);
+	mutex_spinunlock(&mru->lock);
 
 	list_for_each_entry_safe(elem, next, &tmp, list_node) {
 
@@ -294,7 +294,7 @@ _xfs_mru_cache_reap(
 	if (!mru->reap_all)
 		queue_delayed_work(xfs_mru_reap_wq, &mru->work, mru->grp_time);
 	mru->reap_all = 0;
-	mutex_spinunlock(&mru->lock, 0);
+	mutex_spinunlock(&mru->lock);
 }
 
 int
@@ -413,7 +413,7 @@ xfs_mru_cache_flush(
 
 	mutex_spinlock(&mru->lock);
 	mru->reap_all = 1;
-	mutex_spinunlock(&mru->lock, 0);
+	mutex_spinunlock(&mru->lock);
 
 	queue_work(xfs_mru_reap_wq, &mru->work.work);
 	flush_workqueue(xfs_mru_reap_wq);
@@ -423,7 +423,7 @@ xfs_mru_cache_flush(
 	mru->reap_all = 0;
 	if (restart)
 		queue_delayed_work(xfs_mru_reap_wq, &mru->work, mru->grp_time);
-	mutex_spinunlock(&mru->lock, 0);
+	mutex_spinunlock(&mru->lock);
 }
 
 void
@@ -476,7 +476,7 @@ xfs_mru_cache_insert(
 	radix_tree_preload_end();
 	_xfs_mru_cache_list_insert(mru, elem);
 
-	mutex_spinunlock(&mru->lock, 0);
+	mutex_spinunlock(&mru->lock);
 
 	return 0;
 }
@@ -506,7 +506,7 @@ xfs_mru_cache_remove(
 		list_del(&elem->list_node);
 	}
 
-	mutex_spinunlock(&mru->lock, 0);
+	mutex_spinunlock(&mru->lock);
 
 	if (elem)
 		kmem_zone_free(xfs_mru_elem_zone, elem);
@@ -563,7 +563,7 @@ xfs_mru_cache_lookup(
 		_xfs_mru_cache_list_insert(mru, elem);
 	}
 	else
-		mutex_spinunlock(&mru->lock, 0);
+		mutex_spinunlock(&mru->lock);
 
 	return elem ? elem->value : NULL;
 }
@@ -590,7 +590,7 @@ xfs_mru_cache_peek(
 	mutex_spinlock(&mru->lock);
 	elem = radix_tree_lookup(&mru->store, key);
 	if (!elem)
-		mutex_spinunlock(&mru->lock, 0);
+		mutex_spinunlock(&mru->lock);
 
 	return elem ? elem->value : NULL;
 }
@@ -604,5 +604,5 @@ void
 xfs_mru_cache_done(
 	xfs_mru_cache_t	*mru)
 {
-	mutex_spinunlock(&mru->lock, 0);
+	mutex_spinunlock(&mru->lock);
 }
fs/xfs/xfs_qmops.c +2 -3
Index: linux/fs/xfs/xfs_qmops.c
===================================================================
@@ -47,7 +47,6 @@ xfs_mount_reset_sbqflags(xfs_mount_t *mp
 {
 	int			error;
 	xfs_trans_t		*tp;
-	unsigned long		s;
 
 	mp->m_qflags = 0;
 	/*
@@ -56,9 +55,9 @@ xfs_mount_reset_sbqflags(xfs_mount_t *mp
 	 */
 	if (mp->m_sb.sb_qflags == 0)
 		return 0;
-	s = XFS_SB_LOCK(mp);
+	XFS_SB_LOCK(mp);
 	mp->m_sb.sb_qflags = 0;
-	XFS_SB_UNLOCK(mp, s);
+	XFS_SB_UNLOCK(mp);
 
 	/*
 	 * if the fs is readonly, let the incore superblock run
fs/xfs/xfs_trans.c +3 -4
Index: linux/fs/xfs/xfs_trans.c
===================================================================
@@ -1328,7 +1328,6 @@ xfs_trans_chunk_committed(
 	xfs_lsn_t		item_lsn;
 	struct xfs_mount	*mp;
 	int			i;
-	SPLDECL(s);
 
 	lidp = licp->lic_descs;
 	for (i = 0; i < licp->lic_unused; i++, lidp++) {
@@ -1369,7 +1368,7 @@ xfs_trans_chunk_committed(
 		 * the test below.
 		 */
 		mp = lip->li_mountp;
-		AIL_LOCK(mp,s);
+		AIL_LOCK(mp);
 		if (XFS_LSN_CMP(item_lsn, lip->li_lsn) > 0) {
 			/*
 			 * This will set the item's lsn to item_lsn
@@ -1378,9 +1377,9 @@ xfs_trans_chunk_committed(
 			 *
 			 * xfs_trans_update_ail() drops the AIL lock.
 			 */
-			xfs_trans_update_ail(mp, lip, item_lsn, s);
+			xfs_trans_update_ail(mp, lip, item_lsn);
 		} else {
-			AIL_UNLOCK(mp, s);
+			AIL_UNLOCK(mp);
 		}
 
 		/*
fs/xfs/xfs_trans_ail.c +20 -24

146 lines not on this page · raw message

fs/xfs/xfs_trans_priv.h +2 -3
Index: linux/fs/xfs/xfs_trans_priv.h
===================================================================
@@ -47,11 +47,10 @@ xfs_log_busy_slot_t		*xfs_trans_add_busy
  * From xfs_trans_ail.c
  */
 void			xfs_trans_update_ail(struct xfs_mount *mp,
-				     struct xfs_log_item *lip, xfs_lsn_t lsn,
-				     unsigned long s)
+				     struct xfs_log_item *lip, xfs_lsn_t lsn)
 				     __releases(mp->m_ail_lock);
 void			xfs_trans_delete_ail(struct xfs_mount *mp,
-				     struct xfs_log_item *lip, unsigned long s)
+				     struct xfs_log_item *lip)
 				     __releases(mp->m_ail_lock);
 struct xfs_log_item	*xfs_trans_first_ail(struct xfs_mount *, int *);
 struct xfs_log_item	*xfs_trans_next_ail(struct xfs_mount *,
fs/xfs/xfs_utils.c +3 -4
Index: linux/fs/xfs/xfs_utils.c
===================================================================
@@ -335,7 +335,6 @@ xfs_bump_ino_vers2(
 	xfs_inode_t	*ip)
 {
 	xfs_mount_t	*mp;
-	unsigned long		s;
 
 	ASSERT(ismrlocked (&ip->i_lock, MR_UPDATE));
 	ASSERT(ip->i_d.di_version == XFS_DINODE_VERSION_1);
@@ -345,13 +344,13 @@ xfs_bump_ino_vers2(
 	memset(&(ip->i_d.di_pad[0]), 0, sizeof(ip->i_d.di_pad));
 	mp = tp->t_mountp;
 	if (!XFS_SB_VERSION_HASNLINK(&mp->m_sb)) {
-		s = XFS_SB_LOCK(mp);
+		XFS_SB_LOCK(mp);
 		if (!XFS_SB_VERSION_HASNLINK(&mp->m_sb)) {
 			XFS_SB_VERSION_ADDNLINK(&mp->m_sb);
-			XFS_SB_UNLOCK(mp, s);
+			XFS_SB_UNLOCK(mp);
 			xfs_mod_sb(tp, XFS_SB_VERSIONNUM);
 		} else {
-			XFS_SB_UNLOCK(mp, s);
+			XFS_SB_UNLOCK(mp);
 		}
 	}
 	/* Caller must log the inode */
fs/xfs/xfs_vfsops.c +2 -3
Index: linux/fs/xfs/xfs_vfsops.c
===================================================================
@@ -839,7 +839,6 @@ xfs_statvfs(
 	xfs_extlen_t	lsize;
 	xfs_mount_t	*mp;
 	xfs_sb_t	*sbp;
-	unsigned long	s;
 
 	mp = XFS_BHVTOM(bdp);
 	sbp = &(mp->m_sb);
@@ -847,7 +846,7 @@ xfs_statvfs(
 	statp->f_type = XFS_SB_MAGIC;
 
 	xfs_icsb_sync_counters_flags(mp, XFS_ICSB_LAZY_COUNT);
-	s = XFS_SB_LOCK(mp);
+	XFS_SB_LOCK(mp);
 	statp->f_bsize = sbp->sb_blocksize;
 	lsize = sbp->sb_logstart ? sbp->sb_logblocks : 0;
 	statp->f_blocks = sbp->sb_dblocks - lsize;
@@ -867,7 +866,7 @@ xfs_statvfs(
 						statp->f_files,
 						mp->m_maxicount);
 	statp->f_ffree = statp->f_files - (sbp->sb_icount - sbp->sb_ifree);
-	XFS_SB_UNLOCK(mp, s);
+	XFS_SB_UNLOCK(mp);
 
 	xfs_statvfs_fsid(statp, mp);
 	statp->f_namelen = MAXNAMELEN - 1;
fs/xfs/xfs_vnodeops.c +3 -3
Index: linux/fs/xfs/xfs_vnodeops.c
===================================================================
@@ -3740,11 +3740,11 @@ xfs_inode_flush(
 		if (iip && iip->ili_last_lsn) {
 			xlog_t		*log = mp->m_log;
 			xfs_lsn_t	sync_lsn;
-			int		s, log_flags = XFS_LOG_FORCE;
+			int		log_flags = XFS_LOG_FORCE;
 
-			s = GRANT_LOCK(log);
+			GRANT_LOCK(log);
 			sync_lsn = log->l_last_sync_lsn;
-			GRANT_UNLOCK(log, s);
+			GRANT_UNLOCK(log);
 
 			if ((XFS_LSN_CMP(iip->ili_last_lsn, sync_lsn) <= 0))
 				return 0;
#1 lore raw
Quoted 5 lines · Eric Sandeen

The "s" in these locking macros used to be used like flags in spin_lock_irqsave; but in the xfs codebase today it's never used.

gcc optimizes it away, but still, why keep it around?

If we change away from the IRIX compatible signatures we could just kill the lock wrappers aswell..

#2 lore raw
Quoted 9 lines · Christoph Hellwig
Quoted 5 lines · Eric Sandeen

The "s" in these locking macros used to be used like flags in spin_lock_irqsave; but in the xfs codebase today it's never used.

gcc optimizes it away, but still, why keep it around?

If we change away from the IRIX compatible signatures we could just kill the lock wrappers aswell..

Hmmm - decisions, decisions... ;)

I think killing the wrappers entirely is probably the correct thing to do. stuff like AIL_LOCK and GRANT_LOCK have long just been a wrapper around a spinlock with no other purpose except to shout at you.

If we are going to kill the spl return from the spinlocks, then lets just churn this once. I'll sit on this one for a bit....

FWIW, Eric, if you do decide to modify the patch to kill all the wrappers, can you send them as a patch-per-wrapper, just to make it easy to review?

Cheers,

Dave.

Signature · 3 lines
Dave Chinner
Principal Engineer
SGI Australian Software Group
#3 lore raw
Quoted 17 lines · David Chinner
Quoted 8 lines · Christoph Hellwig
Quoted 5 lines · Eric Sandeen

The "s" in these locking macros used to be used like flags in spin_lock_irqsave; but in the xfs codebase today it's never used.

gcc optimizes it away, but still, why keep it around?

If we change away from the IRIX compatible signatures we could just kill the lock wrappers aswell..

Hmmm - decisions, decisions... ;)

I think killing the wrappers entirely is probably the correct thing to do. stuff like AIL_LOCK and GRANT_LOCK have long just been a wrapper around a spinlock with no other purpose except to shout at you.

Quoted 6 lines

If we are going to kill the spl return from the spinlocks, then lets just churn this once. I'll sit on this one for a bit....

FWIW, Eric, if you do decide to modify the patch to kill all the wrappers, can you send them as a patch-per-wrapper, just to make it easy to review?

Ok...

Russell suggested "xfs_spinlock" ;-) I assume you want to just use the linux native locking calls?

-Eric