mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: disk_file: Add SparseCapable trait
Sparse and zero flag support for thin provisioned disk images. Two methods with false defaults: sparse operations (punch hole, write zeroes, discard) and zero flag optimization in WRITE_ZEROES. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
b98a5cc58d
commit
a0a5718b42
@@ -65,3 +65,19 @@ pub trait Geometry: Send + Debug {
|
||||
DiskTopology::default()
|
||||
}
|
||||
}
|
||||
|
||||
/// Sparse and zero flag support for thin provisioned disk images.
|
||||
pub trait SparseCapable: Send + Debug {
|
||||
/// Indicates support for sparse operations (punch hole, write zeroes, discard).
|
||||
fn supports_sparse_operations(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
/// Indicates support for a metadata level zero flag optimization in
|
||||
/// virtio `VIRTIO_BLK_T_WRITE_ZEROES` requests. When true, the format
|
||||
/// can mark regions as reading zeros via a metadata bit rather than
|
||||
/// writing actual zero bytes to disk.
|
||||
fn supports_zero_flag(&self) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user