unionfs-fuse
unionfs-fuse copied to clipboard
Use clone copy for copy-up operation on APFS file systems on MacOS
The APFS filesystem for MacOS has a built in COW feature which is implemented at the block level. Performing a copy up operation using the file clone would dramatically improve the performance with very little extra required to implement it. It would just involve changing the existing copy function to use the macOS clone when it can. The APFS COW is performed at the block level, and the initial clone in instant as no data is copied at that point. And only as blocks are changed are those individual blocks copied.
What exactly would you have to add? Any documentation?
You can probably change cow.c
at copy_file
to say if __APPLE__
is defined, use clonefile(from,to,flags)
, else use copy_file
as a preprocessor directive. Shouldn't be too hard.
Well, patches welcome I guess. But note that unionfs does full file copies, while it looks like you want to use block level cow. Not impossible, but quite some work for full block level cow...
Well, patches welcome I guess. But note that unionfs does full file copies, while it looks like you want to use block level cow. Not impossible, but quite some work for full block level cow...
The point is its not work at all because the block level COW is performed by APFS. It is just a change from doing an actual file copy to a "clone copy" at the point it does the copy-up. On the command line its as simple as adding -c
to the copy command.
So what is the "-c" option actually doing - which system call switches it to? Please check with strace what changes.... I guess you could then easily update the code to add this in.