Re: fsync on large files

Edgar Toernig (froese@gmx.de)
Fri, 19 Feb 1999 16:28:53 +0100


Hi,

Linus Torvalds wrote:
> Imagine, for example, a directory tree with a shared component. Wouldn't
> it be nice to just link it into the tree at multiple points? Imagine a
> chroot() environment, for a moment - symlinks don't work to the outside,
> but hardlinking does.

Sure, it would be nice. But it's really hard and not easy to implement.

The traditional unix filesystem forms a nice n-ary tree. Symbolic links
turn your tree into a graph. But, it is required, that the tree be
preserved by the hard links. The soft links are just there to go
somewhere in different ways. They do not _build_ the tree.

mkdir creates a new leaf node, unlink removes one, and rename moves a
subtree to a different location. Checks like: you mustn't move a dir
to one if its descendants (meaning, you mustn't disconnect a subtree
from the main tree), are easy because there's only _one_ point where
this node is connected to the tree.

If you allow directory hardlinks (or loopback mounts) you get a completely
different structure: a directed graph with all it's problems (like rings).
Reconfiguring a graph with some constraints like: you mustn't isolate a
subgraph from the one containing the root node, is pretty hard. You
have to scan the _whole_ graph to check this. And, try to remove a
part of the graph. There may be _no_ leaf nodes, only rings. This means,
you have to allow to unlink non-empty dirs. And this results in a garbage
collector...

Yeah, would be nice, but hard *g*

Ciao, ET.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/