/* Write out pagecache data for the whole filesystem.  */
int xfs_sync_data(struct xfs_mount *mp, int flags)
/* Write out pagecache data for the whole filesystem.  */
int xfs_sync_data(struct xfs_mount *mp, int flags)
{
	int			error;
	ASSERT((flags & ~(SYNC_TRYLOCK|SYNC_WAIT)) == 0);
	error = xfs_inode_ag_iterator(mp, xfs_sync_inode_data, flags,
				      XFS_ICI_NO_TAG, 0);
	if (error)
		return XFS_ERROR(error);
	xfs_log_force(mp, 0,
		      (flags & SYNC_WAIT) ?
		       XFS_LOG_FORCE | XFS_LOG_SYNC :
		       XFS_LOG_FORCE);
	return 0;
}