From c6e28b66c6683c69aec50dd51d8538425a924ab6 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Sat, 18 May 2019 12:57:43 +0200 Subject: [PATCH] src/client/pxar_backup_stream.rs: use 1M pipe buffer size --- src/client/pxar_backup_stream.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/client/pxar_backup_stream.rs b/src/client/pxar_backup_stream.rs index 9b3246db..dffdd589 100644 --- a/src/client/pxar_backup_stream.rs +++ b/src/client/pxar_backup_stream.rs @@ -37,11 +37,14 @@ impl Drop for PxarBackupStream { impl PxarBackupStream { pub fn new(mut dir: Dir, path: PathBuf, all_file_systems: bool, verbose: bool) -> Result { - let mut buffer = Vec::with_capacity(4096); + let buffer_size = 1024*1024; + let mut buffer = Vec::with_capacity(buffer_size); unsafe { buffer.set_len(buffer.capacity()); } let (rx, tx) = nix::unistd::pipe()?; + nix::fcntl::fcntl(rx, nix::fcntl::FcntlArg::F_SETPIPE_SZ(buffer_size as i32))?; + let child = thread::spawn(move|| { let mut writer = unsafe { std::fs::File::from_raw_fd(tx) }; if let Err(err) = pxar::Encoder::encode(path, &mut dir, &mut writer, all_file_systems, verbose) {