5
0
mirror of git://git.proxmox.com/git/proxmox-backup.git synced 2024-12-22 13:34:16 +03:00

client: pxar: early return on exclude pattern match

Move the exclude pattern matching further up to avoid unnecessary
instantiation of the metadata object, not needed if the entry was
matched.

No functional change intended.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
Christian Ebner 2024-02-21 15:48:04 +01:00 committed by Dietmar Maurer
parent 9052dff2b3
commit f755dc3eaa

View File

@ -539,15 +539,6 @@ impl Archiver {
None => return Ok(()),
};
let metadata = get_metadata(
fd.as_raw_fd(),
stat,
self.flags(),
self.fs_magic,
&mut self.fs_feature_flags,
self.skip_e2big_xattr,
)?;
let match_path = PathBuf::from("/").join(self.path.clone());
if self
.patterns
@ -557,6 +548,15 @@ impl Archiver {
return Ok(());
}
let metadata = get_metadata(
fd.as_raw_fd(),
stat,
self.flags(),
self.fs_magic,
&mut self.fs_feature_flags,
self.skip_e2big_xattr,
)?;
let file_name: &Path = OsStr::from_bytes(c_file_name.to_bytes()).as_ref();
match metadata.file_type() {
mode::IFREG => {