Need copy_file_range() which uses FSCTL_DUPLICATE_EXTENTS_TO_FILE

Open
#310 10 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
c

Research direction

Start by tracing the MSYS2 runtime implementation or entry point for copy_file_range() and how it maps file-copy operations on Windows. Investigate FSCTL_DUPLICATE_EXTENTS_TO_FILE and verify that coreutils cp and mv can use the new behavior on ReFS without breaking ordinary filesystems; done means large-file copies on ReFS use block cloning and retain a fallback.

Written by the indexing model from the issue text.

Description

MSYS2 file copy is EXTREMELY slow for big files on REFS on Windows 11.

Since Win10 is soon End-of-support MSYS2 more and more people use REFS, and there MSYS2 is slow.
It turns out that cmd.exe and powershell.exe cheat a bit when copying files on REFS: They do not copy data, they clone blocks via FSCTL_DUPLICATE_EXTENTS_TO_FILE.

coreutils cp and mv could do the same IF MSYS2 would implement copy_file_range() backed by FSCTL_DUPLICATE_EXTENTS_TO_FILE.

Dominant language
C
Stars
240
Forks
60
Avg merge
2d 3h
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from msys2/msys2-runtime

All issues in msys2/msys2-runtime

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.