lkml.org 
[lkml]   [2006]   [Jul]   [24]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: what is necessary for directory hard links
From Valdis.Kletnieks@vt ...
DateMon, 24 Jul 2006 03:25:29 -0400
On Mon, 24 Jul 2006 10:45:45 +0400, Nikita Danilov said:
> Joshua Hudson writes:

>  > In my filesystem, any attempt to create a loop of hard links
>  > is detected and cancelled. > > Can you elaborate a bit on this exciting mechanism? Obviously an ability
> to efficiently detect loops would be a break-through in a
> reference-counted garbage collection, somehow missed for last 40

It's actually pretty trivial to do if it's a toy filesystem and all the
relevant inodes are in-memory already.  The hard-to-solve part is getting
around the (apparent) need to walk across essentially the entire tree
structure making sure that you aren't creating a loop.  This can get
rather performance piggy - even /home on my laptop has some 400K
inodes on it, and a 'find /home -type d' takes 28 seconds.  That's a *long*
time to lock and freeze a filesystem.

Where it gets *really* messy is that it isn't just mkdir that's the problem -
once you let there be more than one path from the fs root to a given directory,
it gets *really* hard to make sure that any given 'mv' command isn't going to
to screw things up (is 'mv a/b/c/d ../../w/z/b' safe? How do you know, without
examining a *lot* of stuff under a/ and ../../w/?

[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2006-07-24 09:29    [from the cache]
©2003-2008