ron minnich <[email protected]> writes:
> If you look at what a hard link is, you'll realize why they are not in
> Plan 9.
It's not that obvious to me. A hard link is another name for a file,
uniquely identified by <type,device,qid>. The effect of a hard link can
be simulated with bind, but requires managing a list of excetions (one
bind for each "link"). If the binding were done server-side, there
would need to be some additional protocol element (perhaps a Tbind
request) to add another name to a file. The semantics of Tbind could
meaningfully be extended to all types of files, not just disk files.
I don't understand why 9P doesn't allow transporting bind operations
from machine to machine like this. /sys/doc/9.ps talks about ongoing
research on ways to export namespaces from one machine to another.
Allowing binds to traverse 9P seems to be an easy way to do that.
The alternative, making a full copy of the file/directory, wastes disk
space (unless it's de-duplicated by Venti) and bandwidth.
It's similar for moving directories. If you have a 10 GiB directory,
doing dircp&&rm requires 20 GiB to traverse the link to the file server.
At $local_big_networking_corp, I got chewed out for copying a 650MB ISO
across a single router. If the 9P Twstat message had a destdirfid
field, a fid could be relocated by altering file system metadata alone.
If the destdirfid does not represent a directory, or represents a
location on a different <type,device> file system, then just return
Rerror("move crosses bind") and make the client do a full dircp&&rm.
I suppose it's possible to interpose a file system, call it "linkfs",
between the file server and user processes. Something like:
term% linkfs -f /path/to/persistent/bind/cache
term% mount /srv/linkfs /
term% echo foo > /some/path
term% echo /some/path /another/path > /dev/hardlink
term% cat /another/path
foo
AFAIK, "linkfs" doesn't exist. I totally made it up; I'm just throwing
out some ideas, here.
--
+---------------------------------------------------------------+
|E-Mail: [email protected] PGP key ID: BC549F8B|
|Fingerprint: 9329 DB4A 30F5 6EDA D2BA 3489 DAB7 555A BC54 9F8B|
+---------------------------------------------------------------+