public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Shan Shaji <s.shaji@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [RFC PATCH proxmox-backup 1/6] refactor: rename `ReuseStats` struct to `PxarArchiverProgressStats`
Date: Wed, 10 Jun 2026 20:02:03 +0200	[thread overview]
Message-ID: <20260610180208.801614-2-s.shaji@proxmox.com> (raw)
In-Reply-To: <20260610180208.801614-1-s.shaji@proxmox.com>

Earlier, the `ReuseStats` struct was used to count and show summary for
metadata mode. Since, the same counter will be used to show stats for
both legacy and data mode, rename `ReuseStats` struct to
`PxarArchiverProgressStats` and its corresponding propery inside the
archiver to `progress_stats`.

Signed-off-by: Shan Shaji <s.shaji@proxmox.com>
---
 pbs-client/src/pxar/create.rs | 46 +++++++++++++++++------------------
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/pbs-client/src/pxar/create.rs b/pbs-client/src/pxar/create.rs
index 304de4d83..c7f26879e 100644
--- a/pbs-client/src/pxar/create.rs
+++ b/pbs-client/src/pxar/create.rs
@@ -150,7 +150,7 @@ pub(crate) struct HardLinkInfo {
 }
 
 #[derive(Default)]
-struct ReuseStats {
+struct PxarArchiverProgressStats {
     files_reused_count: u64,
     files_hardlink_count: u64,
     files_reencoded_count: u64,
@@ -193,7 +193,7 @@ struct Archiver {
     // an older client without the encode-time check is detected here and the affected file is
     // re-encoded instead of reused.
     last_reusable_offset: Option<u64>,
-    reuse_stats: ReuseStats,
+    progress_stats: PxarArchiverProgressStats,
     split_archive: bool,
 }
 
@@ -304,7 +304,7 @@ where
         previous_payload_index,
         cache: PxarLookaheadCache::new(options.max_cache_size),
         last_reusable_offset: None,
-        reuse_stats: ReuseStats::default(),
+        progress_stats: PxarArchiverProgressStats::default(),
         split_archive,
     };
 
@@ -325,28 +325,28 @@ where
         info!("Change detection summary:");
         info!(
             " - {} total files ({} hardlinks)",
-            archiver.reuse_stats.files_reused_count
-                + archiver.reuse_stats.files_reencoded_count
-                + archiver.reuse_stats.files_hardlink_count,
-            archiver.reuse_stats.files_hardlink_count,
+            archiver.progress_stats.files_reused_count
+                + archiver.progress_stats.files_reencoded_count
+                + archiver.progress_stats.files_hardlink_count,
+            archiver.progress_stats.files_hardlink_count,
         );
         info!(
             " - {} unchanged, reusable files with {} data",
-            archiver.reuse_stats.files_reused_count,
-            HumanByte::from(archiver.reuse_stats.total_reused_payload_size),
+            archiver.progress_stats.files_reused_count,
+            HumanByte::from(archiver.progress_stats.total_reused_payload_size),
         );
         info!(
             " - {} changed or non-reusable files with {} data",
-            archiver.reuse_stats.files_reencoded_count,
-            HumanByte::from(archiver.reuse_stats.total_reencoded_size),
+            archiver.progress_stats.files_reencoded_count,
+            HumanByte::from(archiver.progress_stats.total_reencoded_size),
         );
         info!(
             " - {} padding in {} partially reused chunks",
             HumanByte::from(
-                archiver.reuse_stats.total_injected_size
-                    - archiver.reuse_stats.total_reused_payload_size
+                archiver.progress_stats.total_injected_size
+                    - archiver.progress_stats.total_reused_payload_size
             ),
-            archiver.reuse_stats.partial_chunks_count,
+            archiver.progress_stats.partial_chunks_count,
         );
     }
     Ok(())
@@ -971,24 +971,24 @@ impl Archiver {
                 }
 
                 let offset: LinkOffset = if let Some(payload_offset) = payload_offset {
-                    self.reuse_stats.total_reused_payload_size +=
+                    self.progress_stats.total_reused_payload_size +=
                         file_size + size_of::<pxar::format::Header>() as u64;
-                    self.reuse_stats.files_reused_count += 1;
+                    self.progress_stats.files_reused_count += 1;
 
                     encoder
                         .add_payload_ref(metadata, file_name, file_size, payload_offset)
                         .await?
                 } else {
-                    self.reuse_stats.total_reencoded_size +=
+                    self.progress_stats.total_reencoded_size +=
                         file_size + size_of::<pxar::format::Header>() as u64;
-                    self.reuse_stats.files_reencoded_count += 1;
+                    self.progress_stats.files_reencoded_count += 1;
 
                     self.add_regular_file(encoder, fd, file_name, metadata, file_size)
                         .await?
                 };
 
                 if stat.st_nlink > 1 {
-                    self.reuse_stats.files_hardlink_count += 1;
+                    self.progress_stats.files_hardlink_count += 1;
                     self.hardlinks
                         .insert(link_info, (self.path.clone(), offset));
                 }
@@ -1215,11 +1215,11 @@ impl Archiver {
                     HumanByte::from(chunk.padding),
                     HumanByte::from(chunk.size()),
                 );
-                self.reuse_stats.total_injected_size += chunk.size();
-                self.reuse_stats.total_injected_count += 1;
+                self.progress_stats.total_injected_size += chunk.size();
+                self.progress_stats.total_injected_count += 1;
 
                 if chunk.padding > 0 {
-                    self.reuse_stats.partial_chunks_count += 1;
+                    self.progress_stats.partial_chunks_count += 1;
                 }
 
                 size = size.add(chunk.size());
@@ -2075,7 +2075,7 @@ mod tests {
                 suggested_boundaries: Some(suggested_boundaries),
                 cache: PxarLookaheadCache::new(None),
                 last_reusable_offset: None,
-                reuse_stats: ReuseStats::default(),
+                progress_stats: PxarArchiverProgressStats::default(),
                 split_archive: true,
             };
 
-- 
2.47.3





  reply	other threads:[~2026-06-10 18:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-10 18:02 [RFC PATCH proxmox-backup 0/6] fix #7024: client: add file statistics inside logs Shan Shaji
2026-06-10 18:02 ` Shan Shaji [this message]
2026-06-10 18:02 ` [RFC PATCH proxmox-backup 2/6] fix #7024: pxar: show archiver summary for legacy and data mode Shan Shaji
2026-06-10 18:02 ` [RFC PATCH proxmox-backup 3/6] refactor: use atomic values in `PxarArchiverProgressStats` Shan Shaji
2026-06-10 18:02 ` [RFC PATCH proxmox-backup 4/6] fix #7024: cli: show number of processed files during backup Shan Shaji
2026-06-10 18:02 ` [RFC PATCH proxmox-backup 5/6] refactor: rename `UploadCounters` to `UploadProgress` Shan Shaji
2026-06-10 18:02 ` [RFC PATCH proxmox-backup 6/6] fix #7024: cli: add option to enable verbose logs Shan Shaji

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=20260610180208.801614-2-s.shaji@proxmox.com \
    --to=s.shaji@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