datastore: avoid calculating protected attribute twice

The protected status of the snapshot is retrieved twice. This is slow
because it stat's the .protected file multiple times.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
Tested-by: Christian Ebner <c.ebner@proxmox.com>
Reviewed-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
Gabriel Goller 2024-07-03 17:02:46 +02:00 committed by Wolfgang Bumiller
parent 625e2fd95f
commit 0e9aa78bf4

View File

@ -505,7 +505,7 @@ unsafe fn list_snapshots_blocking(
group: group.into(),
time: info.backup_dir.backup_time(),
};
let protected = info.backup_dir.is_protected();
let protected = info.protected;
match get_all_snapshot_files(&info) {
Ok((manifest, files)) => {