From 899d82f22637edab65b5d165dbadd7ffe1c7760e Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Thu, 9 Mar 2023 16:19:10 -0500 Subject: [PATCH] Revert "osmet: avoid install performance regression in debug mode on Rust 1.64+" The Rust regression was fixed by https://github.com/rust-lang/rust/pull/102760, which is in Rust 1.66+. Our MSRV is 1.66.0, so we can drop this. This reverts commit 1ccb9b091afddca29fe64135882a48b7295e6ab8. --- docs/release-notes.md | 1 - src/osmet/unpacker.rs | 9 ++------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/docs/release-notes.md b/docs/release-notes.md index d31f32e4a..bdea43c94 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -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: diff --git a/src/osmet/unpacker.rs b/src/osmet/unpacker.rs index 235c5a43b..22a515398 100644 --- a/src/osmet/unpacker.rs +++ b/src/osmet/unpacker.rs @@ -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; @@ -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 {