linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Getting dentry from inode
@ 2006-04-17 17:08 UZAIR LAKHANI
  2006-04-17 17:35 ` Dave Kleikamp
  0 siblings, 1 reply; 2+ messages in thread
From: UZAIR LAKHANI @ 2006-04-17 17:08 UTC (permalink / raw)
  To: linux-fsdevel

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.

(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.

Thanks,
Uzair Lakhani


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Getting dentry from inode
  2006-04-17 17:08 Getting dentry from inode UZAIR LAKHANI
@ 2006-04-17 17:35 ` Dave Kleikamp
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Kleikamp @ 2006-04-17 17:35 UTC (permalink / raw)
  To: UZAIR LAKHANI; +Cc: linux-fsdevel

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-04-17 17:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-17 17:08 Getting dentry from inode UZAIR LAKHANI
2006-04-17 17:35 ` Dave Kleikamp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).