/* If the flags parameter is BUF_TRYLOCK, then we'll only return the superblock buffer if it can be locked without sleeping. If it can't then we'll return NULL.  */
xfs_buf_t* xfs_getsb(xfs_mount_t *mp, int flags)
/* If the flags parameter is BUF_TRYLOCK, then we'll only return the superblock buffer if it can be locked without sleeping. If it can't then we'll return NULL.  */
xfs_buf_t* xfs_getsb(xfs_mount_t *mp, int flags)
{
	xfs_buf_t	*bp;
	ASSERT(mp->m_sb_bp != NULL);
	bp = mp->m_sb_bp;
	if (flags & XFS_BUF_TRYLOCK) {
		if (!XFS_BUF_CPSEMA(bp)) {
			return NULL;
		}
	} else {
		XFS_BUF_PSEMA(bp, PRIBIO);
	}
	XFS_BUF_HOLD(bp);
	ASSERT(XFS_BUF_ISDONE(bp));
	return bp;
}