src/client/pxar_backup_stream.rs: use 1M pipe buffer size
This commit is contained in:
parent
6276448519
commit
c6e28b66c6
|
@ -37,11 +37,14 @@ impl Drop for PxarBackupStream {
|
||||||
impl PxarBackupStream {
|
impl PxarBackupStream {
|
||||||
|
|
||||||
pub fn new(mut dir: Dir, path: PathBuf, all_file_systems: bool, verbose: bool) -> Result<Self, Error> {
|
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()); }
|
unsafe { buffer.set_len(buffer.capacity()); }
|
||||||
|
|
||||||
let (rx, tx) = nix::unistd::pipe()?;
|
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 child = thread::spawn(move|| {
|
||||||
let mut writer = unsafe { std::fs::File::from_raw_fd(tx) };
|
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) {
|
if let Err(err) = pxar::Encoder::encode(path, &mut dir, &mut writer, all_file_systems, verbose) {
|
||||||
|
|
Loading…
Reference in New Issue