diff --git a/block/src/disk_file.rs b/block/src/disk_file.rs index 9dd52be6d..3b3aa0fec 100644 --- a/block/src/disk_file.rs +++ b/block/src/disk_file.rs @@ -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 + } +}