/* If the end of the buffer has been reached, return -EAGAIN, if not, return the offset within the buffer of the next entry to be read.  */
static int find_dirent(nfs_readdir_descriptor_t *desc)
/* If the end of the buffer has been reached, return -EAGAIN, if not, return the offset within the buffer of the next entry to be read.  */
static int find_dirent(nfs_readdir_descriptor_t *desc)
{
	struct nfs_entry *entry = desc->entry;
	int		loop_count = 0,
			status;
	while((status = dir_decode(desc)) == 0) {
		dfprintk(DIRCACHE, "NFS: %s: examining cookie %Lu\n",
				__func__, (unsigned long long)entry->cookie);
		if (entry->prev_cookie == *desc->dir_cookie)
			break;
		if (loop_count++ > 200) {
			loop_count = 0;
			schedule();
		}
	}
	return status;
}