Skip to content

Commit

Permalink
Merge pull request #1131 from bgilbert/rust-perf
Browse files Browse the repository at this point in the history
Revert "osmet: avoid install performance regression in debug mode on Rust 1.64+"
  • Loading branch information
bgilbert authored Mar 10, 2023
2 parents ec30751 + 899d82f commit 9231169
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
1 change: 0 additions & 1 deletion docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ Minor changes:
- customize: Support Ignition config spec 3.4.0
- customize: Avoid disabling ISO autologin when only changing live kargs
- customize: Warn when customized PXE image requires Ignition kargs
- install: Avoid osmet performance regression in debug builds on Rust 1.64+
- install: Avoid network fetch timeout when low-level formatting ECKD DASD

Internal changes:
Expand Down
9 changes: 2 additions & 7 deletions src/osmet/unpacker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

use std::ffi::OsStr;
use std::fs::{File, OpenOptions};
use std::io::{self, copy, BufWriter, ErrorKind, Read, Seek, SeekFrom, Write};
use std::io::{self, copy, ErrorKind, Read, Seek, SeekFrom, Write};
use std::os::unix::ffi::{OsStrExt, OsStringExt};
use std::path::{Path, PathBuf};
use std::thread;
Expand Down Expand Up @@ -107,16 +107,11 @@ fn osmet_unpack_to_writer(
repo: PathBuf,
writer: impl Write,
) -> Result<()> {
// Work around https://github.com/rust-lang/rust/issues/102727 by
// buffering writes into chunks the same size as the buffer
// used by write_image() when reading from us
let buffered = BufWriter::with_capacity(BUFFER_SIZE, writer);
let mut w = WriteHasher::new_sha256(buffered)?;
let mut w = WriteHasher::new_sha256(writer)?;
let n = write_unpacked_image(&mut packed_image, &mut w, &osmet.partitions, &repo)?;
if n != osmet.size {
bail!("wrote {} bytes but expected {}", n, osmet.size);
}
w.flush()?;

let final_checksum: Sha256Digest = w.try_into()?;
if final_checksum != osmet.checksum {
Expand Down

0 comments on commit 9231169

Please sign in to comment.