/* Walk the inode alias list, and find a dentry which has a given parent. ocfs2_dentry_attach_lock() wants to find  */
struct dentry* ocfs2_find_local_alias(struct inode *inode, u64 parent_blkno, int skip_unhashed)
/* Walk the inode alias list, and find a dentry which has a given parent. ocfs2_dentry_attach_lock() wants to find  */
struct dentry* ocfs2_find_local_alias(struct inode *inode, u64 parent_blkno, int skip_unhashed)
{
	struct list_head *p;
	struct dentry *dentry = NULL;
	spin_lock(&dcache_lock);
	list_for_each(p, &inode->i_dentry) {
		dentry = list_entry(p, struct dentry, d_alias);
		if (ocfs2_match_dentry(dentry, parent_blkno, skip_unhashed)) {
			mlog(0, "dentry found: %.*s\n",
			     dentry->d_name.len, dentry->d_name.name);
			dget_locked(dentry);
			break;
		}
		dentry = NULL;
	}
	spin_unlock(&dcache_lock);
	return dentry;
}