From: Andreas Dilger <adilger@sun.com>
To: Alberich de megres <alberich2k5@gmail.com>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: save path to a file
Date: Thu, 04 Jun 2009 15:23:34 -0600 [thread overview]
Message-ID: <20090604212334.GO9002@webber.adilger.int> (raw)
In-Reply-To: <12d708830906041305u7964737el1bdd1a5b1c214315@mail.gmail.com>
On Jun 04, 2009 22:05 +0200, Alberich de megres wrote:
> I got one questiong about saving file path to an inode. The idea is to
> have some data on inode that allows me to get path ( or one of the
> paths ) to this file ( whithout using d_find_alias, well i don't know
> any other way since an inode could have many paths ).
>
> If i save full path to an inode ( on the same inode using xattr ),
> this works fine since i got full path to a file but of course if i
> change mount point for this partition.
We have implemented an attribute for Lustre that stores an array of
(the Lustre equivalent of) {parent inode, filename}[] tuples as an
extended attribute on each inode. There need to be multiple entries
in case of hard links to the file. Using the parent inode number(s)
allows reconstructing the full pathname(s) in O(num_links) for each
file, without significant overhead.
While this attribute needs to be updated for rename/link/unlink, the
inode itself has to be dirtied due to ctime/nlinks updates, and if
the attribute is stored inside the inode itself (in the most common
nlinks==1 case) there are no additional seeks.
Implementing this for ext4 would be fairly interesting, and would
allow e2fsck to recover from e.g. complete destruction of the directory
tree, so long as the inode tables are intact.
Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.
next prev parent reply other threads:[~2009-06-04 21:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-04 20:05 save path to a file Alberich de megres
2009-06-04 21:23 ` Andreas Dilger [this message]
[not found] ` <12d708830906051421yb3f08d4m83e132df9376c3b@mail.gmail.com>
2009-06-08 21:48 ` Andreas Dilger
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=20090604212334.GO9002@webber.adilger.int \
--to=adilger@sun.com \
--cc=alberich2k5@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
/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).