Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use clone copy for copy-up operation on APFS file systems on MacOS #119

Open
WaterJuice opened this issue May 1, 2022 · 5 comments
Open

Comments

@WaterJuice
Copy link

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.

@DUOLabs333
Copy link

What exactly would you have to add? Any documentation?

@DUOLabs333
Copy link

DUOLabs333 commented May 16, 2022

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.

@bsbernd
Copy link
Contributor

bsbernd commented May 23, 2022

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...

@WaterJuice
Copy link
Author

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.

@bsbernd
Copy link
Contributor

bsbernd commented Aug 12, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants