-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Add more constraints for block cloning #15251
Conversation
- We cannot clone into files with smaller block size if there is more than one block, since we can not grow the block size. - Block size must be power-of-2 if destination offset != 0, since there can be no multiple blocks of non-power-of-2 size. The first should handle the case when destination file has several blocks but still is not bigger than one block of the source file. The second fixes panic in dmu_buf_hold_array_by_dnode() on attempt to concatenate files with equal but non-power-of-2 block sizes. While there, assert that error is reported if we made no progress. Signed-off-by: Alexander Motin <[email protected]> Sponsored by: iXsystems, Inc.
cc: @robn @oromenahar. |
Another theoretical guess while thinking about this area: if we use block cloning to concatenate one 512 byte file to another 512 byte file we'll get a file with two 512 byte blocks, but I am not sure we really want that. We may wish to restrict minimal copy size to allow block sizes to grow towards recordsize in normal way instead. |
Looks good to me. Thank you Alex for looking into this! |
- We cannot clone into files with smaller block size if there is more than one block, since we can not grow the block size. - Block size must be power-of-2 if destination offset != 0, since there can be no multiple blocks of non-power-of-2 size. The first should handle the case when destination file has several blocks but still is not bigger than one block of the source file. The second fixes panic in dmu_buf_hold_array_by_dnode() on attempt to concatenate files with equal but non-power-of-2 block sizes. While there, assert that error is reported if we made no progress. Reviewed-by: Pawel Jakub Dawidek <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Rob Norris <[email protected]> Reviewed-by: Kay Pedersen <[email protected]> Reviewed-by: Umer Saleem <[email protected]> Signed-off-by: Alexander Motin <[email protected]> Sponsored by: iXsystems, Inc. Closes openzfs#15251
The first should handle the case when destination file has several blocks but still is not bigger than one block of the source file. The second fixes panic in dmu_buf_hold_array_by_dnode() on attempt to concatenate files with equal but non-power-of-2 block sizes.
While there, assert that error is reported if we made no progress.
How Has This Been Tested?
Reproduced kernel panic on FreeBSD with the script from https://lists.freebsd.org/archives/freebsd-current/2023-September/004610.html and confirmed that it works after.
Types of changes
Checklist:
Signed-off-by
.