linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Kleikamp <shaggy@austin.ibm.com>
To: UZAIR LAKHANI <uzairr_bs1b@yahoo.com>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: Getting dentry from inode
Date: Mon, 17 Apr 2006 12:35:48 -0500	[thread overview]
Message-ID: <1145295349.31818.5.camel@kleikamp.austin.ibm.com> (raw)
In-Reply-To: <20060417170843.14107.qmail@web37912.mail.mud.yahoo.com>

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


      reply	other threads:[~2006-04-17 17:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-17 17:08 Getting dentry from inode UZAIR LAKHANI
2006-04-17 17:35 ` Dave Kleikamp [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1145295349.31818.5.camel@kleikamp.austin.ibm.com \
    --to=shaggy@austin.ibm.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=uzairr_bs1b@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).