-
Notifications
You must be signed in to change notification settings - Fork 596
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
Fix nativeimgutil.ConvertToRaw() #2718
Conversation
d55a1a0
to
0819f1d
Compare
Thanks, this seems to work, but the output is confusing
It should be like
|
But this does not work for the raw-to-raw case, which must expand the image as a second step. I think we should keep the same flow since it is simple, easy to follow, and make it easy to verify that the convert was correct before expanding. So I plan to do this:
|
Do you plan to update this PR or open a follow-up PR separately ? |
I can update it this weekend. |
- Truncate before copying the data to eliminate the seeks during the copy. This also provides a hint to the file system that can minimize allocations and fragmentation of the file. - Avoid unneeded seeks during copy using WriteAt. This does not improve performance since practically all time is spent on reading from the source image. - Fix zero detection to handle short reads. Previously we would compare the entire buffer which can contain non-zero bytes from the previous read. - Fix write to handle short reads. Previously we would write the entire buffer including data from previous read, corrupting the image. - Fix error message for failed write. Looks like it was copied from the read branch. Signed-off-by: Nir Soffer <[email protected]>
@AkihiroSuda new version keeps the same user interface:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
Truncate before copying the data to eliminate the seeks during the
copy. This also provides a hint to the file system that can minimize
allocations and fragmentation of the file.
Avoid unneeded seeks during copy using WriteAt. This does not improve
performance since practically all time is spent on reading from the
source image.
Fix zero detection to handle short reads. Previously we would compare
the entire buffer which can contain non-zero bytes from the previous
read.
Fix write to handle short reads. Previously we would write the entire
buffer including data from previous read, corrupting the image.
Fix error message for failed write. Looks like it was copied from the
read branch.