block: qcow: Delete QcowFile

Delete the now unused QcowFile implementation it was only used for
creating disk images for the tests and for the performance-metrics. It
was not used for the virtio-block device.

Assisted-by: Claude:claude-opus-4-7
Signed-off-by: Rob Bradford <rbradford@meta.com>
This commit is contained in:
Rob Bradford
2026-06-05 19:42:14 +01:00
parent 1120fe74f5
commit 829676e640
4 changed files with 10 additions and 1590 deletions

View File

@@ -176,9 +176,5 @@ pub fn shared_backing_from(bf: BackingFile) -> BlockResult<Arc<dyn BackingRead>>
backing_file: backing.map(|bf| shared_backing_from(*bf)).transpose()?,
}))
}
#[cfg(test)]
BackingKind::QcowFile(_) => {
unreachable!("QcowFile variant is only used by set_backing_file() in tests")
}
}
}

View File

@@ -520,19 +520,6 @@ impl QcowState {
}
}
/// Maps a single cluster region for a sequential read.
pub(crate) fn map_cluster_read(
&mut self,
address: u64,
count: usize,
has_backing_file: bool,
) -> io::Result<ClusterReadMapping> {
match self.try_map_read(address, count, has_backing_file)? {
Some(mapping) => Ok(mapping),
None => self.map_read_with_populate(address, count, has_backing_file),
}
}
/// Write path mapping. Always called under write lock.
fn map_write(
&mut self,

File diff suppressed because it is too large Load Diff

View File

@@ -224,41 +224,6 @@ impl RefCount {
Ok(self.refblock_cache.get(table_index).unwrap()[block_index])
}
/// Returns the refcount table for this file. This is only useful for debugging.
pub fn ref_table(&self) -> &[u64] {
self.ref_table.get_values()
}
/// Returns the refcounts stored in the given block.
pub fn refcount_block(
&mut self,
raw_file: &mut QcowRawFile,
table_index: usize,
) -> Result<Option<&[u64]>> {
let block_addr_disk = *self.ref_table.get(table_index).ok_or(Error::InvalidIndex)?;
if block_addr_disk == 0 {
return Ok(None);
}
if !self.refblock_cache.contains_key(table_index) {
let table = VecCache::from_vec(
raw_file
.read_refcount_block(block_addr_disk)
.map_err(Error::ReadingRefCounts)?,
);
// TODO(dgreid) - closure needs to return an error.
let ref_table = &self.ref_table;
self.refblock_cache
.insert(table_index, table, |index, evicted| {
raw_file.write_refcount_block(ref_table[index], evicted.get_values())
})
.map_err(Error::EvictingRefCounts)?;
}
// The index must exist as it was just inserted if it didn't already.
Ok(Some(
self.refblock_cache.get(table_index).unwrap().get_values(),
))
}
// Gets the address of the refcount block and the index into the block for the given address.
fn get_refcount_index(&self, address: u64) -> (usize, usize) {
let block_index = (address / self.cluster_size) % self.refcount_block_entries;