8000 Feature/local sparse by theVerySharpFlat · Pull Request #8619 · rclone/rclone · GitHub
[go: up one dir, main page]

Skip to content

Feature/local sparse #8619

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

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

theVerySharpFlat 8000
Copy link

What is the purpose of this change?

Ensure sparse blocks are maintained as well as possible in local to local transfers.

To do so, I use the FS_IOC_FIEMAP ioctl on linux to list out all of the non-sparse extents, which are then passed to the multi threaded transfer system, which has been slightly modified to accept non-constant size chunks.

https://forum.rclone.org/t/possible-to-use-rclone-with-sparse/45189

Checklist

  • I have read the contribution guidelines.
  • I have added tests for all changes in this PR if appropriate.
  • I have added documentation for the changes if appropriate.
  • All commit messages are in house style.
  • I'm done, this Pull Request is ready for review :-)

@ncw
Copy link
Member
ncw commented Jun 19, 2025

We can't use CGO in rclone - it complicates the multiplatform build too much.

Is there another way of doing this?

Perhaps we should just check for zero bytes in the writer and create sparse files then? I'm pretty sure that is what rsync does with

   --sparse, -S             turn sequences of nulls into sparse blocks

That would be a much smaller patch.

@theVerySharpFlat
Copy link
Author

We can't use CGO in rclone - it complicates the multiplatform build too much.

Is there another way of doing this?

Perhaps we should just check for zero bytes in the writer and create sparse files then? I'm pretty sure that is what rsync does with

   --sparse, -S             turn sequences of nulls into sparse blocks

That would be a much smaller patch.

Yeah, but let's admit, it's a little less cool. That's probably a good thing though. I'll get to work on that

@theVerySharpFlat
Copy link
Author

@ncw 1673acc implements rsync-style sparse preservation.

This thing depends on openChunkWriterfromOpenWriterAt for multithreaded copies and WriterAt in general. For single threaded copies, I've only gone in and implemented this for the local backend by changing the backend-specific update function. Is this alright? I think the usage of fs/operations in backend/local might create a circular dependency in the tests (again). IMHO, it would be the smoothest to force multithreaded transfers (default 1 thread) when --sparse is specified.

Second, tests for sparseness may be hard to do as sparseness is very fs/os version dependent. How do we want to proceed given this?

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

Successfully merging this pull request may close these issues.

2 participants
0