block: qcow: Cache cluster_size in per queue structs

Cache the immutable cluster_size value at construction time in
QcowAsync, QcowSync, and Qcow2Backing. This avoids repeated RwLock
read acquisitions on the hot write and deallocation paths.

Replace QcowMetadata::cluster_offset() calls with inline bitmask
operations using the cached cluster_size. Remove the now unused
cluster_offset() method from QcowMetadata.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
Anatol Belski
2026-04-17 20:53:54 +02:00
committed by Rob Bradford
parent d9b188c1be
commit 659f7c17e5
3 changed files with 14 additions and 14 deletions
-5
View File
@@ -333,11 +333,6 @@ impl QcowMetadata {
pub fn cluster_size(&self) -> u64 {
self.inner.read().unwrap().raw_file.cluster_size()
}
/// Returns the intra cluster byte offset for a given guest address.
pub fn cluster_offset(&self, address: u64) -> u64 {
self.inner.read().unwrap().raw_file.cluster_offset(address)
}
}
impl QcowState {