/* This is called to unpin an inode. It can be directed to wait or to return immediately without waiting for the inode to be unpinned. The caller must have the inode locked in at least shared mode so that the buffer cannot be subsequently pinned once someone is waiting for it to be unpinned.  */
STATIC void __xfs_iunpin_wait(xfs_inode_t *ip, int wait)
/* This is called to unpin an inode. It can be directed to wait or to return immediately without waiting for the inode to be unpinned. The caller must have the inode locked in at least shared mode so that the buffer cannot be subsequently pinned once someone is waiting for it to be unpinned.  */
STATIC void __xfs_iunpin_wait(xfs_inode_t *ip, int wait)
{
	xfs_inode_log_item_t	*iip = ip->i_itemp;
	ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED));
	if (atomic_read(&ip->i_pincount) == 0)
		return;
	xfs_log_force(ip->i_mount, (iip && iip->ili_last_lsn) ?
				iip->ili_last_lsn : 0, XFS_LOG_FORCE);
	if (wait)
		wait_event(ip->i_ipin_wait, (atomic_read(&ip->i_pincount) == 0));
}