/* The inodes to be written are parked on bdi->b_io. They are moved back onto bdi->b_dirty as they are selected for writing. This way, none can be missed on the writer throttling path, and we get decent balancing between many throttled threads: we don't want them all piling up on inode_sync_wait.  */
static void wait_sb_inodes(struct super_block *sb)
/* The inodes to be written are parked on bdi->b_io. They are moved back onto bdi->b_dirty as they are selected for writing. This way, none can be missed on the writer throttling path, and we get decent balancing between many throttled threads: we don't want them all piling up on inode_sync_wait.  */
static void wait_sb_inodes(struct super_block *sb)
{
	struct inode *inode, *old_inode = NULL;
	WARN_ON(!rwsem_is_locked(&sb->s_umount));
	spin_lock(&inode_lock);
	list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
		struct address_space *mapping;
		if (inode->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE|I_NEW))
			continue;
		mapping = inode->i_mapping;
		if (mapping->nrpages == 0)
			continue;
		__iget(inode);
		spin_unlock(&inode_lock);
		iput(old_inode);
		old_inode = inode;
		filemap_fdatawait(mapping);
		cond_resched();
		spin_lock(&inode_lock);
	}
	spin_unlock(&inode_lock);
	iput(old_inode);
}