diff --git a/src/backup/chunk_store.rs b/src/backup/chunk_store.rs index 4d3a9b3d..06b6b74c 100644 --- a/src/backup/chunk_store.rs +++ b/src/backup/chunk_store.rs @@ -191,6 +191,7 @@ impl ChunkStore { pub fn get_chunk_iterator( &self, + print_percentage: bool, ) -> Result< impl Iterator>, Error @@ -210,10 +211,12 @@ impl ChunkStore { let mut last_percentage = 0; Ok((0..0x10000).filter_map(move |index| { - let percentage = (index * 100) / 0x10000; - if last_percentage != percentage { - last_percentage = percentage; - eprintln!("percentage done: {}", percentage); + if print_percentage { + let percentage = (index * 100) / 0x10000; + if last_percentage != percentage { + last_percentage = percentage; + eprintln!("percentage done: {}", percentage); + } } let subdir: &str = &format!("{:04x}", index); match tools::fs::read_subdir(base_handle.as_raw_fd(), subdir) { @@ -252,7 +255,7 @@ impl ChunkStore { let now = unsafe { libc::time(std::ptr::null_mut()) }; - for entry in self.get_chunk_iterator()? { + for entry in self.get_chunk_iterator(true)? { let (dirfd, entry) = match entry { Ok(entry) => (entry.parent_fd(), entry), Err(_) => continue, // ignore errors diff --git a/src/backup/datastore.rs b/src/backup/datastore.rs index 98944e59..78b032a1 100644 --- a/src/backup/datastore.rs +++ b/src/backup/datastore.rs @@ -86,11 +86,12 @@ impl DataStore { pub fn get_chunk_iterator( &self, + print_percentage: bool, ) -> Result< impl Iterator>, Error > { - self.chunk_store.get_chunk_iterator() + self.chunk_store.get_chunk_iterator(print_percentage) } pub fn create_fixed_writer>(&self, filename: P, size: usize, chunk_size: usize) -> Result {