Re: save path to a file

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

 



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.

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