Re: [PATCH] cowlinks v2

Eric W. Biederman
2004-03-25T22:19:32Z

Linus Torvalds <torvalds@osdl.org> writes:

> On Thu, 25 Mar 2004, Jamie Lokier wrote:
> >
> > That is not useful for me or the other people who want to use this to
> > duplicate large source trees and run "diff" between trees.
> >
> > "diff" depends on being able to check if files in the two trees are
> > identical -- by checking whether the inode number and device (and
> > maybe other stat data) are identical. This allows "diff -ur" between
> > two cloned trees the size of linux to be quite fast. Without that
> > optimisation, it's very slow indeed.
>
> I think the correct thing to do is to just admit that cowlinks aren't
> POSIX, and instead see the inode number as a way to see whether the link
> has been broken or not. Ie just accept the inode number potentially
> changing.
>
> That would make "diff" (adn most other uses) ok with this, and anythign
> that isn't, just couldn't be used with cowlinked files.

Really?

tar and cp still need to be taught about them. And if they are not taught
they will do the wrong thing and hard link the files removing the
copy on write semantics. Which would do ugly thing when you restore
from your backup.

I don't have a problem with the inode number changing when you write to
a file, because I can't think of much that would care either way.
But having the inode number of an open file change sounds like a very
difficult problem to track.

Maybe aiming cow links at things like a live cd filesystem is too
ambitious, but it sounds like a minimal clean way to handle all of
the dependencies on writeable files that show up.

Eric