Looking at a file with n references by hard links: n=1 is the trivial case. No changes needed.
All involved directories are read-only: Another trivial case to be ignored here. For n>1: I would suggest that the file is compressed and the directory entries are adjusted accordingly, if the directories can be written. If some directories are read-only, then you end up with 2 files, the new compressed file and the old original still referenced in the read-only directories. The workaround for compressing a file with several references in the file system is *very* ugly, even if you know all paths pointing to it. And the need for compressing such a file comes up especially for large files, i.e. those files that are efficient to compress, but not easy to copy. Rotated log files with a size of a few GBytes, for example. Its just a suggestion, of course. Keep on your good work Harri