Am 08.03.2012 18:15, schrieb Paolo Bonzini: > In the next patches we will declare the guest's semantics for discard > to be "always zero the data". We need to know whether the operation > need to be emulated or can be passed down. For this purpose we need > to know the semantics of the operation and its granularity. > > The granularity may not be related to the cluster size (for example > "raw" does not have a cluster size), so add it separately. > > Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> > --- > block.h | 4 ++++ > block/qcow2.c | 2 ++ > qemu-io.c | 5 ++++- > 3 files changed, 10 insertions(+), 1 deletions(-) > > diff --git a/block.h b/block.h > index 48d0bf3..7feda73 100644 > --- a/block.h > +++ b/block.h > @@ -15,6 +15,10 @@ typedef struct BlockDriverInfo { > int cluster_size; > /* offset at which the VM state can be saved (0 if not possible) */ > int64_t vm_state_offset; > + /* whether discard is guaranteed to zero bytes */ > + bool discard_zeroes_data; > + /* discard granularity in sectors */ > + int discard_granularity;
Why not in bytes? The arbitrary 512 byte units used in the block layer were probably not the best idea ever and we shouldn't spread it further. Kevin