cache_lookup() work this week.

Chris Pressey cpressey at catseye.mine.nu
Thu Sep 4 08:56:29 PDT 2003


On Wed, 3 Sep 2003 23:55:01 -0700 (PDT)
Matthew Dillon <dillon at xxxxxxxxxxxxxxxxxxxx> wrote:

>     It's very easy to find loops.  All the program has to do is
>     record the (rdev,inode#) for each directory element in the path
>     as it recurses.  Only the (rdev,inode#) for the elements
>     representing the current path need to be remembered so the memory
>     use is small. e.g.:
> 
>     a[1,23]/b[1,55]/c[1,78]/d[1,55]
> 
>     In this case d[1,55] is a hardlink to b.  find, rm, whatever would
>     see that the identifying information [1,55] is the same as for b
>     which is still in its path and not recurse through it.
> 
>     It is an easy trick to implement.

Yes.  But the problem is that there are umpteen dozen dozen programs
which take an -R flag or otherwise traverse directory trees, which would
have to be patched.  It would be a big job, no matter how simple the
change is, so I think it would be better to address it somewhere in the
OS itself.

Just because you can do something doesn't mean you necessarily should...
what's the value of hardlinking a directory to one of its parent
directories?  Where would this be useful?

-Chris





More information about the Kernel mailing list