On Fri, Aug 25, 2023 at 13:52:14 +0200, Kristina Hanicova wrote: > This introduces the ability to set the discard granularity option > for a disk. It defines the smallest amount of data that can be > discarded in a single operation (useful for managing and > optimizing storage). > > Signed-off-by: Kristina Hanicova <khanicov@xxxxxxxxxx> > --- > docs/formatdomain.rst | 6 +++++- > src/conf/domain_conf.c | 19 ++++++++++++++++++- > src/conf/domain_conf.h | 1 + > src/conf/domain_validate.c | 3 ++- > src/conf/schemas/domaincommon.rng | 5 +++++ > src/qemu/qemu_domain.c | 2 ++ > 6 files changed, 33 insertions(+), 3 deletions(-) > > diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst > index cd9cb02bf8..0d0812f08c 100644 > --- a/docs/formatdomain.rst > +++ b/docs/formatdomain.rst > @@ -2588,7 +2588,7 @@ paravirtualized driver is specified via the ``disk`` element. > <driver name='qemu' type='raw'/> > <source dev='/dev/sda'/> > <geometry cyls='16383' heads='16' secs='63' trans='lba'/> > - <blockio logical_block_size='512' physical_block_size='4096'/> > + <blockio logical_block_size='512' physical_block_size='4096' discard_granularity='4096'/> > <target dev='hdj' bus='ide'/> > </disk> > <disk type='volume' device='disk'> > @@ -3435,6 +3435,10 @@ paravirtualized driver is specified via the ``disk`` element. > this would be the value returned by the BLKPBSZGET ioctl and describes the > disk's hardware sector size which can be relevant for the alignment of > disk data. > + ``discard_granularity`` > + The smallest amount of data that can be discarded in a single operation. > + It impacts the unmap operations and it must be a multiple of a > + ``logical_block_size``. Add a note that most hypervisors select the proper setting and users don't really need to tweak this. Reviewed-by: Peter Krempa <pkrempa@xxxxxxxxxx>