3 ms·
Another problem with hard links: you can not hard link a directory. It would make ".." ambiguous. Also with hard link directories, you would want to be able "
by jhallenworld 4y ago
Another problem with hard links: you can not hard link a directory. It would make ".." ambiguous.
Also with hard link directories, you would want to be able "rmdir" non-empty directories, just to delete the link. But then you have the problem of reference loops, so how do you reclaim space reliably? You would need a garbage collection algorithm to find data not reachable by root.
- jmillikin 4y agoWhether directories can be hardlinked depends on the filesystem and OS. When macOS switched from HFS+ to APFS, one of the changes was that they dropped support for directory hardlinks. https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/APFS_Guide/FAQ/FAQ.html https://developer.apple.com/library/archive/documentation/Fi...
- jhallenworld 4y agoI'm not a macOS user, but these sure seem to add complexity: https://stackoverflow.com/questions/80875/what-is-the-unix-command-to-create-a-hardlink-to-a-directory-in-os-x https://stackoverflow.com/questions/80875/what-is-the-unix-c... The filesystem has to check for and disallow loops.
- nine_k 4y agoThe GC algorithms for hardlinked directories can be the same as for harlinked files: reference counting.
- jhallenworld 4y agoOnly if there are no loops..
- samatman 4y agoA filesystem can afford a very, very slow, mark and sweep.
- kasabali 4y agoTell that to btrfs :)