src/client/pxar_backup_stream.rs: use 1M pipe buffer size

This commit is contained in:
Dietmar Maurer 2019-05-18 12:57:43 +02:00
parent 6276448519
commit c6e28b66c6

View File

@ -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<Self, Error> {
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) {