/* Write out and wait upon all dirty data associated with this superblock. Filesystem data as well as the underlying block device. Takes the superblock lock.  */
int sync_filesystem(struct super_block *sb)
/* Write out and wait upon all dirty data associated with this superblock. Filesystem data as well as the underlying block device. Takes the superblock lock.  */
int sync_filesystem(struct super_block *sb)
{
	int ret;
	WARN_ON(!rwsem_is_locked(&sb->s_umount));
	if (sb->s_flags & MS_RDONLY)
		return 0;
	ret = __sync_filesystem(sb, 0);
	if (ret < 0)
		return ret;
	return __sync_filesystem(sb, 1);
}