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

Allow block cloning to be interrupted by a signal. #16208

Merged
merged 1 commit into from
May 25, 2024

Conversation

pjd
Copy link
Contributor

@pjd pjd commented May 19, 2024

Even though block cloning is much faster than regular copying, it is not instantaneous - the file might be large and the recordsize small. It would be nice to be able to interrupt it with a signal (e.g., SIGINFO on FreeBSD to see the progress).

Motivation and Context

Description

How Has This Been Tested?

With those changes I can interrupt cloning large files, which was impossible before.

This allows to only to stop cloning in the middle, but also to track progress with SIGINFO.
Also see: https://reviews.freebsd.org/D45243

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

Even though block cloning is much faster than regular copying,
it is not instantaneous - the file might be large and the recordsize
small. It would be nice to be able to interrupt it with a signal
(e.g., SIGINFO on FreeBSD to see the progress).

Signed-off-by: Pawel Jakub Dawidek <[email protected]>
@johnpyp
Copy link

johnpyp commented May 22, 2024

Does this warrant a test case or two?

Also, does this cancel the block clone cleanly without anything leftover? (I'm not familiar with the flow/error handling)

@pjd
Copy link
Contributor Author

pjd commented May 22, 2024

Does this warrant a test case or two?

I think it might be unstable to try to send signal before the operation finishes. It will be easier once ratelimiting is merged - then we will be able to slow down block cloning and make it predictable when sending a signal.

Also, does this cancel the block clone cleanly without anything leftover? (I'm not familiar with the flow/error handling)

At least on FreeBSD, the only interface to use block cloning currently is through copy_file_range(2). copy_file_range(2) can be interrupted before the whole file is copied and the caller should just continue and keep at it until copy_file_range(2) returns <= 0. So when block cloning is interrupted we simply did a partial clone and the application should continue to finish the operation.

@behlendorf behlendorf merged commit 08648cf into openzfs:master May 25, 2024
24 checks passed
@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) BRT BRT tracking labels May 25, 2024
lundman pushed a commit to openzfsonwindows/openzfs that referenced this pull request Sep 4, 2024
Even though block cloning is much faster than regular copying,
it is not instantaneous - the file might be large and the recordsize
small. It would be nice to be able to interrupt it with a signal
(e.g., SIGINFO on FreeBSD to see the progress).

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Pawel Jakub Dawidek <[email protected]>
Closes openzfs#16208
ptr1337 pushed a commit to CachyOS/zfs that referenced this pull request Nov 14, 2024
Even though block cloning is much faster than regular copying,
it is not instantaneous - the file might be large and the recordsize
small. It would be nice to be able to interrupt it with a signal
(e.g., SIGINFO on FreeBSD to see the progress).

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Pawel Jakub Dawidek <[email protected]>
Closes openzfs#16208
ptr1337 pushed a commit to CachyOS/zfs that referenced this pull request Nov 21, 2024
Even though block cloning is much faster than regular copying,
it is not instantaneous - the file might be large and the recordsize
small. It would be nice to be able to interrupt it with a signal
(e.g., SIGINFO on FreeBSD to see the progress).

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Pawel Jakub Dawidek <[email protected]>
Closes openzfs#16208
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BRT BRT tracking Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants