[pbs-devel] [PATCH proxmox-backup 2/2] client: pxar: early return on exclude pattern match

Christian Ebner c.ebner at proxmox.com
Wed Feb 21 15:48:04 CET 2024


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 at proxmox.com>
---
 pbs-client/src/pxar/create.rs | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/pbs-client/src/pxar/create.rs b/pbs-client/src/pxar/create.rs
index fa16abfe..60efb0ce 100644
--- a/pbs-client/src/pxar/create.rs
+++ b/pbs-client/src/pxar/create.rs
@@ -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 => {
-- 
2.39.2





More information about the pbs-devel mailing list