Re: Getting dentry from inode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2006-04-17 at 10:08 -0700, UZAIR LAKHANI wrote:
> Hello All,
> 
> I want to know about these two questions.
> 
> (1) How to get a pointer to an inode if one has only
> the inode number available. May I use the iget()
> function. I only want a reference to the inode whose
> number I have.

It sounds like iget() is what you want.

> (2) How to get the dentry from inode. Is d_find_alias
> ok. There can be multiple dentries attached to a
> single inode then which dentry will d_find_alias will
> return. I want only access to a dentry from inode
> number.

I think d_alloc_anon() may do what you want.

inode = iget(sb, inum);
if (!inode)
	bail out;
if (is_bad_inode(inode)) {
	iput(inode);
	bail out;
}
dentry = d_alloc_anon(inode);
if (!dentry) {
	iput(inode)
	bail out;
}
d_alloc_anon returns an existing dentry for the inode if it can find
one.  Otherwise, it will allocate a new, anonymous dentry.

> Thanks,
> Uzair Lakhani

Hope this helps,
Shaggy
-- 
David Kleikamp
IBM Linux Technology Center

-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux