[pbs-devel] [PATCH proxmox-backup] datastore: use cached snapshot time string in path

Gabriel Goller g.goller at proxmox.com
Wed Jul 3 17:08:36 CEST 2024


When getting the `full_path` of a snapshot we did not use the cached
time string. By using it we avoid a call to the super-slow libc strftime.

This has some minor performance improvements of circa 7%. That is ~100ms
on my datastore with ~5000 snapshots.

Signed-off-by: Gabriel Goller <g.goller at proxmox.com>
---
 pbs-datastore/src/backup_info.rs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pbs-datastore/src/backup_info.rs b/pbs-datastore/src/backup_info.rs
index bdfaeabc1d12..414ec878d01a 100644
--- a/pbs-datastore/src/backup_info.rs
+++ b/pbs-datastore/src/backup_info.rs
@@ -415,7 +415,9 @@ impl BackupDir {
 
     /// Returns the absolute path for backup_dir, using the cached formatted time string.
     pub fn full_path(&self) -> PathBuf {
-        self.store.snapshot_path(&self.ns, &self.dir)
+        let mut path = self.store.base_path();
+        path.push(self.relative_path());
+        path
     }
 
     pub fn protected_file(&self) -> PathBuf {
-- 
2.43.0





More information about the pbs-devel mailing list