Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

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.



Whether 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/Fi...


I'm not a macOS user, but these sure seem to add complexity:

https://stackoverflow.com/questions/80875/what-is-the-unix-c...

The filesystem has to check for and disallow loops.


The GC algorithms for hardlinked directories can be the same as for harlinked files: reference counting.


Only if there are no loops..


A filesystem can afford a very, very slow, mark and sweep.


Tell that to btrfs :)




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: