From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 328811FF125 for ; Fri, 31 Jul 2026 16:25:16 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 5BAF721558; Fri, 31 Jul 2026 16:25:15 +0200 (CEST) From: Robert Obkircher To: pbs-devel@lists.proxmox.com Subject: [PATCH proxmox-backup 4/9] datastore: fix inconsistent implementation of index_size method Date: Fri, 31 Jul 2026 16:21:17 +0200 Message-ID: <20260731142430.289893-5-r.obkircher@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260731142430.289893-1-r.obkircher@proxmox.com> References: <20260731142430.289893-1-r.obkircher@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1785507901159 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.150 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_LOW -0.7 Sender listed at https://www.dnswl.org/, low trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: BUQ2RDQEFLLNUXQ6T6WS2G527F6K3DLR X-Message-ID-Hash: BUQ2RDQEFLLNUXQ6T6WS2G527F6K3DLR X-MailFrom: r.obkircher@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Return the file size of fixed index files, just like for dynamic ones. Previously, the size of the referenced backup contents was returned, which is still available via the index_bytes method. The impact of this change should be fairly small, as this only seems to be used by "proxmox-backup-debug inspect file". The original intention was probably to show the file size there, because it also does that for blobs. Fixes: f0d23e537 ("add ctime and size function to IndexFile trait") Signed-off-by: Robert Obkircher --- pbs-datastore/src/fixed_index.rs | 4 ++-- pbs-datastore/src/index.rs | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pbs-datastore/src/fixed_index.rs b/pbs-datastore/src/fixed_index.rs index 8104cbe72..0145f93d3 100644 --- a/pbs-datastore/src/fixed_index.rs +++ b/pbs-datastore/src/fixed_index.rs @@ -187,7 +187,7 @@ impl IndexFile for FixedIndexReader { } fn index_size(&self) -> usize { - self.size as usize + size_of::() + self.index_length * 32 } fn compute_csum(&self) -> ([u8; 32], u64) { @@ -658,7 +658,7 @@ mod tests { fs::write(&path, &data).unwrap(); let reader = FixedIndexReader::open(&path).unwrap(); assert_eq!(reader.index_bytes(), size); - assert_eq!(reader.index_size(), size as usize); + assert_eq!(reader.index_size(), 4096 + 64); assert_eq!(reader.chunk_size, chunk_size as usize); assert_eq!(reader.index_count(), 2); assert_eq!( diff --git a/pbs-datastore/src/index.rs b/pbs-datastore/src/index.rs index b5d20ad91..4c0e9aefb 100644 --- a/pbs-datastore/src/index.rs +++ b/pbs-datastore/src/index.rs @@ -20,9 +20,14 @@ impl ChunkReadInfo { pub trait IndexFile { fn index_count(&self) -> usize; fn index_digest(&self, pos: usize) -> Option<&[u8; 32]>; + + /// The total size of the referenced backup content. fn index_bytes(&self) -> u64; + fn chunk_info(&self, pos: usize) -> Option; fn index_ctime(&self) -> i64; + + /// The size of the index file including the header. fn index_size(&self) -> usize; /// Get the chunk index and the relative offset within it for a byte offset -- 2.47.3