[pbs-devel] [PATCH proxmox master stable-bookworm v3 1/1] pbs api types: extend garbage collection status by cache stats

Christian Ebner c.ebner at proxmox.com
Wed Jun 4 17:34:48 CEST 2025


Add cache stats, containing the number of cache hits and cache misses
encountered during phase 1 of garbage collection in order to display
this information in the garbage collection task log summary.

Make stats optional for backwards compatibility when parsing garbage
collection status during upgrades.

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
changes since version 2:
- Factor out cache counters into own api type
- Make cache stats optional to avoid parsing issues

 pbs-api-types/src/datastore.rs | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/pbs-api-types/src/datastore.rs b/pbs-api-types/src/datastore.rs
index 5bd953ac..4fa4c091 100644
--- a/pbs-api-types/src/datastore.rs
+++ b/pbs-api-types/src/datastore.rs
@@ -1426,6 +1426,16 @@ pub struct TypeCounts {
     pub snapshots: u64,
 }
 
+#[api()]
+#[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq)]
+/// Garbage collection cache statistics
+pub struct GarbageCollectionCacheStats {
+    /// Number of atime update cache hits
+    pub hits: usize,
+    /// Number of atime update cache misses
+    pub misses: usize,
+}
+
 #[api(
     properties: {
         "upid": {
@@ -1459,6 +1469,9 @@ pub struct GarbageCollectionStatus {
     pub removed_bad: usize,
     /// Number of chunks still marked as .bad after garbage collection.
     pub still_bad: usize,
+    /// Statistics of atime update cache
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub cache_stats: Option<GarbageCollectionCacheStats>,
 }
 
 #[api(
-- 
2.39.5





More information about the pbs-devel mailing list