public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 2/2] client: pxar: early return on exclude pattern match
Date: Wed, 21 Feb 2024 15:48:04 +0100	[thread overview]
Message-ID: <20240221144804.455959-2-c.ebner@proxmox.com> (raw)
In-Reply-To: <20240221144804.455959-1-c.ebner@proxmox.com>

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>
---
 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





  reply	other threads:[~2024-02-21 14:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-21 14:48 [pbs-devel] [PATCH proxmox-backup 1/2] client: pxar: fix minor formatting issues Christian Ebner
2024-02-21 14:48 ` Christian Ebner [this message]
2024-02-22  8:07 ` [pbs-devel] applied: " Dietmar Maurer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240221144804.455959-2-c.ebner@proxmox.com \
    --to=c.ebner@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal