Ticket #5082: add file cloning support for FreeBSD, Solaris and macOS#5083
Ticket #5082: add file cloning support for FreeBSD, Solaris and macOS#5083tuffnatty wants to merge 3 commits intoMidnightCommander:masterfrom
Conversation
|
Wow, is it possible to test it in some way? As you can see, we now have CI on FreeBSD. Maybe some way to check that |
|
I've added a very dumb test that seems to work on Linux as well as on FreeBSD. |
To me that looks fantastic, but can't you check that |
2a80fa9 to
e05e311
Compare
|
Hi. It took a bit of time... The new pull request adds macOS and Oracle Solaris support as well. On these platforms, the syscalls for file cloning respond for destination file creation, that is, they take in a path instead of a file descriptor, so the logic around the copy operation had to be adapted. |
zyv
left a comment
There was a problem hiding this comment.
Wow, this really looks fantastic. I'm much impressed. I wonder what the others think. I have but just a few minor comments.
8b2f8c0 to
e52f20c
Compare
|
I've added support for file cloning in append/reget modes. It's working on FreeBSD and Linux when the file offsets are block-aligned. I've also removed the extra #ifs by moving the corresponding checks to autoconf. |
|
The linter fails because I have touched a file with pre-existing invalid formatting. |
This looks good to me! I'm just left wondering whether this is a good idea to enable it by default. Are you planning to do anything else in this PR, or are you considering it ready for review now? |
|
I had to find and click the Submit review button as my previous review comments were in pending state. I don't think I have anything to add or remove at this moment. |
236ce43 to
51a41a2
Compare
zyv
left a comment
There was a problem hiding this comment.
I've fixed the formatting error by adding a few hanging commas (in the same commit). Inasmuch as I'm concerned, this looks ready for merge. Thank you for your high-quality contribution! 👍
|
Thanks @zyv! |
51a41a2 to
37990a8
Compare
|
I've updated the pull request with man page updates; unfortunately, the localized man pages were partially outdated, so I had to fix that, and now the PR depends on #5093, #5095, #5096, #5097, #5098, #5099. My Hungarian is definitely not at the level where I could fix the Hungarian man page as well, so I had to keep it as-is. |
37990a8 to
5675b1f
Compare
|
Could you please rebase and resolve the conflicts? Thank you! |
…macOS and Solaris Signed-off-by: Phil Krylov <phil@krylov.eu> Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
Signed-off-by: Phil Krylov <phil@krylov.eu>
…he Use COW file cloning option Signed-off-by: Phil Krylov <phil@krylov.eu>
5675b1f to
1f95e8c
Compare
|
I've rebased the PR against master and updated the description above to match the actual content. |
Proposed changes
Use
copy_file_range(2)on FreeBSD for file cloning.It should resolve #5082 and probably #4991.
copy_file_range(2)also supports remote NFS operations, but it's out of scope for this change.While we're at it, also add support for
clonefile(2)on macOS andreflink(3C)on Oracle Solaris.The patch also adds support for cloning in Append/Reget modes. This is working only in Linux and FreeBSD and only if the filesystem allows it (e.g. the start offsets must be block-aligned).
As file cloning is not always a desired thing, a new configuration option is introduced to disable it.
Checklist
👉 Our coding style can be found here: https://midnight-commander.org/coding-style/ 👈
git commit --amend -smake indent && make check)I have not added any tests for the feature, as it would involve actions fairly complicated from the ops point of view (like, create a test ZFS filesystem), and the test infrastructure does not offer any support for superuser/VM operations. Butit's working locally, copy/move within one ZFS pool became instant, and the existing tests pass.