On Wed, Dec 29, 2021 at 10:45:12PM -0500, Noel Chiappa wrote:
From: Bakul
Shah
My guess is *not* storing a path instead of a ptr
to the inode was done
to save on memory.
More probably speed; those old disks were not fast, and on a PDP-11, disk
caches were so small that converting the path to the current directory to its
in memory inode could take a bunch of disk reads.
The other problem with storing the path as a string is that if
higher-level directories get renamed, the path would become
invalidated. If you store the cwd as "/foo/bar/baz/quux", and someone
renames "/foo/bar" to "/foo/sadness" the cwd-stored-as-a-string would
become invalidated.
Sure, you could scan the pwd of all the processes running on the
system and do edit all of the strings, but once you go SMP, the
potential locking pitfalls would be numerous.
- Ted