/* This is intended to be called from inside other kernel functions, so we fake some arguments.  */
int ocfs2_dir_foreach(struct inode *inode, loff_t *f_pos, void *priv, filldir_t filldir)
/* This is intended to be called from inside other kernel functions, so we fake some arguments.  */
int ocfs2_dir_foreach(struct inode *inode, loff_t *f_pos, void *priv, filldir_t filldir)
{
	int ret = 0, filldir_err = 0;
	u64 version = inode->i_version;
	while (*f_pos < i_size_read(inode)) {
		ret = ocfs2_dir_foreach_blk(inode, &version, f_pos, priv,
					    filldir, &filldir_err);
		if (ret || filldir_err)
			break;
	}
	if (ret > 0)
		ret = -EIO;
	return 0;
}