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

Commit 1de87444 authored by Ingo Molnar's avatar Ingo Molnar Committed by Dave Kleikamp
Browse files

JFS: semaphore to mutex conversion.



the conversion was generated via scripts, and the result was validated
automatically via a script as well.

build and boot tested.

Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarDave Kleikamp <shaggy@austin.ibm.com>
parent 0a0fc0dd
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -207,12 +207,12 @@ static int jfs_acl_chmod(struct inode *inode)
	rc = posix_acl_chmod_masq(clone, inode->i_mode);
	if (!rc) {
		tid_t tid = txBegin(inode->i_sb, 0);
		down(&JFS_IP(inode)->commit_sem);
		mutex_lock(&JFS_IP(inode)->commit_mutex);
		rc = jfs_set_acl(tid, inode, ACL_TYPE_ACCESS, clone);
		if (!rc)
			rc = txCommit(tid, 1, &inode, 0);
		txEnd(tid);
		up(&JFS_IP(inode)->commit_sem);
		mutex_unlock(&JFS_IP(inode)->commit_mutex);
	}

	posix_acl_release(clone);
+7 −7
Original line number Diff line number Diff line
@@ -89,16 +89,16 @@ int jfs_commit_inode(struct inode *inode, int wait)
	}

	tid = txBegin(inode->i_sb, COMMIT_INODE);
	down(&JFS_IP(inode)->commit_sem);
	mutex_lock(&JFS_IP(inode)->commit_mutex);

	/*
	 * Retest inode state after taking commit_sem
	 * Retest inode state after taking commit_mutex
	 */
	if (inode->i_nlink && test_cflag(COMMIT_Dirty, inode))
		rc = txCommit(tid, 1, &inode, wait ? COMMIT_SYNC : 0);

	txEnd(tid);
	up(&JFS_IP(inode)->commit_sem);
	mutex_unlock(&JFS_IP(inode)->commit_mutex);
	return rc;
}

@@ -335,18 +335,18 @@ void jfs_truncate_nolock(struct inode *ip, loff_t length)
		tid = txBegin(ip->i_sb, 0);

		/*
		 * The commit_sem cannot be taken before txBegin.
		 * The commit_mutex cannot be taken before txBegin.
		 * txBegin may block and there is a chance the inode
		 * could be marked dirty and need to be committed
		 * before txBegin unblocks
		 */
		down(&JFS_IP(ip)->commit_sem);
		mutex_lock(&JFS_IP(ip)->commit_mutex);

		newsize = xtTruncate(tid, ip, length,
				     COMMIT_TRUNCATE | COMMIT_PWMAP);
		if (newsize < 0) {
			txEnd(tid);
			up(&JFS_IP(ip)->commit_sem);
			mutex_unlock(&JFS_IP(ip)->commit_mutex);
			break;
		}

@@ -355,7 +355,7 @@ void jfs_truncate_nolock(struct inode *ip, loff_t length)

		txCommit(tid, 1, &ip, 0);
		txEnd(tid);
		up(&JFS_IP(ip)->commit_sem);
		mutex_unlock(&JFS_IP(ip)->commit_mutex);
	} while (newsize > length);	/* Truncate isn't always atomic */
}

+3 −3
Original line number Diff line number Diff line
@@ -64,9 +64,9 @@
 *	to the persistent bitmaps in dmaps) is guarded by (busy) buffers.
 */

#define BMAP_LOCK_INIT(bmp)	init_MUTEX(&bmp->db_bmaplock)
#define BMAP_LOCK(bmp)		down(&bmp->db_bmaplock)
#define BMAP_UNLOCK(bmp)	up(&bmp->db_bmaplock)
#define BMAP_LOCK_INIT(bmp)	mutex_init(&bmp->db_bmaplock)
#define BMAP_LOCK(bmp)		mutex_lock(&bmp->db_bmaplock)
#define BMAP_UNLOCK(bmp)	mutex_unlock(&bmp->db_bmaplock)

/*
 * forward references
+1 −1
Original line number Diff line number Diff line
@@ -243,7 +243,7 @@ struct dbmap {
struct bmap {
	struct dbmap db_bmap;		/* on-disk aggregate map descriptor */
	struct inode *db_ipbmap;	/* ptr to aggregate map incore inode */
	struct semaphore db_bmaplock;	/* aggregate map lock */
	struct mutex db_bmaplock;	/* aggregate map lock */
	atomic_t db_active[MAXAG];	/* count of active, open files in AG */
	u32 *db_DBmap;
};
+10 −10
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, boolean_t abnr)
	txBeginAnon(ip->i_sb);

	/* Avoid race with jfs_commit_inode() */
	down(&JFS_IP(ip)->commit_sem);
	mutex_lock(&JFS_IP(ip)->commit_mutex);

	/* validate extent length */
	if (xlen > MAXXLEN)
@@ -136,14 +136,14 @@ extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, boolean_t abnr)
	 */
	nxlen = xlen;
	if ((rc = extBalloc(ip, hint ? hint : INOHINT(ip), &nxlen, &nxaddr))) {
		up(&JFS_IP(ip)->commit_sem);
		mutex_unlock(&JFS_IP(ip)->commit_mutex);
		return (rc);
	}

	/* Allocate blocks to quota. */
	if (DQUOT_ALLOC_BLOCK(ip, nxlen)) {
		dbFree(ip, nxaddr, (s64) nxlen);
		up(&JFS_IP(ip)->commit_sem);
		mutex_unlock(&JFS_IP(ip)->commit_mutex);
		return -EDQUOT;
	}

@@ -165,7 +165,7 @@ extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, boolean_t abnr)
	if (rc) {
		dbFree(ip, nxaddr, nxlen);
		DQUOT_FREE_BLOCK(ip, nxlen);
		up(&JFS_IP(ip)->commit_sem);
		mutex_unlock(&JFS_IP(ip)->commit_mutex);
		return (rc);
	}

@@ -177,7 +177,7 @@ extAlloc(struct inode *ip, s64 xlen, s64 pno, xad_t * xp, boolean_t abnr)

	mark_inode_dirty(ip);

	up(&JFS_IP(ip)->commit_sem);
	mutex_unlock(&JFS_IP(ip)->commit_mutex);
	/*
	 * COMMIT_SyncList flags an anonymous tlock on page that is on
	 * sync list.
@@ -222,7 +222,7 @@ int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, boolean_t abnr)
	/* This blocks if we are low on resources */
	txBeginAnon(ip->i_sb);

	down(&JFS_IP(ip)->commit_sem);
	mutex_lock(&JFS_IP(ip)->commit_mutex);
	/* validate extent length */
	if (nxlen > MAXXLEN)
		nxlen = MAXXLEN;
@@ -258,7 +258,7 @@ int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, boolean_t abnr)
	/* Allocat blocks to quota. */
	if (DQUOT_ALLOC_BLOCK(ip, nxlen)) {
		dbFree(ip, nxaddr, (s64) nxlen);
		up(&JFS_IP(ip)->commit_sem);
		mutex_unlock(&JFS_IP(ip)->commit_mutex);
		return -EDQUOT;
	}

@@ -338,7 +338,7 @@ int extRealloc(struct inode *ip, s64 nxlen, xad_t * xp, boolean_t abnr)

	mark_inode_dirty(ip);
exit:
	up(&JFS_IP(ip)->commit_sem);
	mutex_unlock(&JFS_IP(ip)->commit_mutex);
	return (rc);
}
#endif			/* _NOTYET */
@@ -439,12 +439,12 @@ int extRecord(struct inode *ip, xad_t * xp)

	txBeginAnon(ip->i_sb);

	down(&JFS_IP(ip)->commit_sem);
	mutex_lock(&JFS_IP(ip)->commit_mutex);

	/* update the extent */
	rc = xtUpdate(0, ip, xp);

	up(&JFS_IP(ip)->commit_sem);
	mutex_unlock(&JFS_IP(ip)->commit_mutex);
	return rc;
}

Loading