https://bugs.winehq.org/show_bug.cgi?id=55029
Bug ID: 55029 Summary: Wishlist: do reflink on CopyFileW for WINEPREFIX size reduction Product: Wine Version: unspecified Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: enhancement Priority: P2 Component: kernel32 Assignee: wine-bugs@winehq.org Reporter: arthur200126@gmail.com Distribution: ---
The current implementation of CopyFileW consists of a simple read-write loop. This of course is completely fine in terms of Windows emulation, but one of the consequences is huge file size inflation when setting up things like a WINEPREFIX: on a wine 7.7-staging 64-bit install, each fresh prefix takes up 1.2 GiB: 619M of that is System32, and Syswow64 520M.
Doing reflink on the CopyFileW interface (which is what rundll32 uses to get wine.ini set up) would greatly reduce the disk space burden associated with setting up a fresh prefix. Removal of real disk IO would also make the process a lot faster. Back in GNU land, the `cp` utility has been doing reflink by default since June 2020.
https://bugs.winehq.org/show_bug.cgi?id=55029
--- Comment #1 from Jactry Zeng jactry92@gmail.com --- There were some discussions in https://www.winehq.org/pipermail/wine-devel/2022-January/205911.html
https://bugs.winehq.org/show_bug.cgi?id=55029
--- Comment #2 from Mingye Wang arthur200126@gmail.com --- Gotta say the patch is a lot more elegant than what I expected -- no big new protocol for the server, just a little IOCTL that windows already has. The discussion seems to have detailed into something about emulating reflink on ext4, which really should not have stopped the patch from going in!
Welp. Should I CC Alex Xu on this?
https://bugs.winehq.org/show_bug.cgi?id=55029
Shmerl shtetldik@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |shtetldik@gmail.com
--- Comment #3 from Shmerl shtetldik@gmail.com --- Did anything come out of this? These changes don't seem to be merged and there is no merge request opened with this feature.
https://bugs.winehq.org/show_bug.cgi?id=55029
Mingye Wang arthur200126@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |alex_y_xu@yahoo.ca
--- Comment #4 from Mingye Wang arthur200126@gmail.com --- Sherml, I don't think so. Ah what the heck, let's just CC Alex Xu and see what he thinks about maybe giving the patch a new life.
* * *
Typo in comment 2: "detailed" should be "derailed"
https://bugs.winehq.org/show_bug.cgi?id=55029
--- Comment #5 from Alex Xu alex_y_xu@yahoo.ca --- Created attachment 74974 --> https://bugs.winehq.org/attachment.cgi?id=74974 rebased IOCTL_COPYCHUNK patches
I stopped submitting the patches due to apparent lack of interest in wine project. I have done a basic rebase which compiles successfully but haven't tested further. If wine project is interested in accepting them now, I can go through it more carefully.
https://bugs.winehq.org/show_bug.cgi?id=55029
--- Comment #6 from Shmerl shtetldik@gmail.com --- (In reply to Alex Xu from comment #5)
Created attachment 74974 [details] rebased IOCTL_COPYCHUNK patches
I stopped submitting the patches due to apparent lack of interest in wine project. I have done a basic rebase which compiles successfully but haven't tested further. If wine project is interested in accepting them now, I can go through it more carefully.
May be you can turn it into a MR on Wine's gitlab?
I think this is a pretty useful feature.
https://bugs.winehq.org/show_bug.cgi?id=55029
kaan.batin.tr@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |kaan.batin.tr@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=55029
Mingye Wang arthur200126@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |leslie_alistair@hotmail.com
--- Comment #7 from Mingye Wang arthur200126@gmail.com --- This wish just bumped into my eyes again via CC list change. Thanks for reminding me it exists.
Since I am not Alex, I don't think I'm ready to turn this thing into an MR myself and go through all the code review process. But what I can do is, according to https://wiki.winehq.org/Wine-Staging_Contributing, CC one of the stagehands to request that it be considered for wine-staging (which gets used a lot anyways!). I see that Alistair is doing the most of the recent commits to the staging repository, so...
Alistair: Please consider Alex's patches for staging. This way more people can start to test it.
https://bugs.winehq.org/show_bug.cgi?id=55029
--- Comment #8 from Alistair Leslie-Hughes leslie_alistair@hotmail.com --- Currently this doesn't apply cleanly to the latest wine code, so will take sometime to get into shape.
https://bugs.winehq.org/show_bug.cgi?id=55029
Alex Xu alex_y_xu@yahoo.ca changed:
What |Removed |Added ---------------------------------------------------------------------------- Attachment #74974|0 |1 is obsolete| |
--- Comment #9 from Alex Xu alex_y_xu@yahoo.ca --- Created attachment 76668 --> https://bugs.winehq.org/attachment.cgi?id=76668 second rebased IOCTL_COPYCHUNK patches
only minor configure changes and one setupapi line need to be rebased. I've checked that reflink works and can start cmd, but not gui, wow64, run test exe, etc. if there's a serious chance of it getting into wine or wine-staging, I can run some more tests.
https://bugs.winehq.org/show_bug.cgi?id=55029
--- Comment #10 from Alex Xu alex_y_xu@yahoo.ca --- windows supports CoW in CopyFile now: https://devblogs.microsoft.com/engineering-at-microsoft/copy-on-write-in-win.... I think previously CopyFile called IOCTL_COPYCHUNK which is still only for network shares, and now also calls FSCTL_DUPLICATE_EXTENTS_TO_FILE which is only for ReFS.