Re: File has hard-links. Detach before saving?

> Any other opinions?

I think the main question is what the main purpose of hardlinks is.

Is it to (1) save disk space for files that actually happen to be the same
at this very moment, but live separate lives?

Or is it to be (2) a way to have one file accessible by more names, so that
they live the same life?

I think the general right answer is (2), and having two large source trees
and diffing them is an exception. When doing so, you do not explicitely want
hard links, this is just an easy way for saving 50% disk space and making
diff run faster. For the case of "diff" this approach is not the best
possible in theory, but we don't have better in practice. The running time
could be drastically decreased if diff had an option to assume to files are
the same if their size and modification time is the same. For the disk usage
part, IMHO the operating system kernels and file systems should support an
option to copy a whole file using copy-on-write techniques (similar to the
one used in memory management when forking a process) so that it's
completely transparent to the applications and the file is only physically
copied when someone modifies it.

So my vote goes for not detaching hard links by default.


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