mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
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:
committed by
Rob Bradford
parent
d9b188c1be
commit
659f7c17e5
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user