/* Caller can NOT assume anything about the contents of the buffer_heads - they are passed back only so that it can be passed into any one of the manipulation functions (add entry, delete entry, etc). As an example, bh in the extent directory case is a data block, in the inline-data case it actually points to an inode, in the indexed directory case, multiple buffers are involved.  */
int ocfs2_find_entry(const char *name, int namelen, struct inode *dir, struct ocfs2_dir_lookup_result *lookup)
/* Caller can NOT assume anything about the contents of the buffer_heads - they are passed back only so that it can be passed into any one of the manipulation functions (add entry, delete entry, etc). As an example, bh in the extent directory case is a data block, in the inline-data case it actually points to an inode, in the indexed directory case, multiple buffers are involved.  */
int ocfs2_find_entry(const char *name, int namelen, struct inode *dir, struct ocfs2_dir_lookup_result *lookup)
{
	struct buffer_head *bh;
	struct ocfs2_dir_entry *res_dir = NULL;
	if (ocfs2_dir_indexed(dir))
		return ocfs2_find_entry_dx(name, namelen, dir, lookup);
	if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL)
		bh = ocfs2_find_entry_id(name, namelen, dir, &res_dir);
	else
		bh = ocfs2_find_entry_el(name, namelen, dir, &res_dir);
	if (bh == NULL)
		return -ENOENT;
	lookup->dl_leaf_bh = bh;
	lookup->dl_entry = res_dir;
	return 0;
}