]> git.proxmox.com Git - mirror_qemu.git/commit - block/qcow2-cluster.c
qcow2: Add subcluster support to discard_in_l2_slice()
authorAlberto Garcia <berto@igalia.com>
Fri, 10 Jul 2020 16:13:05 +0000 (18:13 +0200)
committerMax Reitz <mreitz@redhat.com>
Tue, 25 Aug 2020 06:33:20 +0000 (08:33 +0200)
commita68cd70326e8a1ee710d420c64693c741403897c
treecf3a54395e4a0f13d90d367ec8354fa01a2ac23e
parent205fa507508e1f8caa79325bafb3cd2ae8814125
qcow2: Add subcluster support to discard_in_l2_slice()

Two things need to be taken into account here:

1) With full_discard == true the L2 entry must be cleared completely.
   This also includes the L2 bitmap if the image has extended L2
   entries.

2) With full_discard == false we have to make the discarded cluster
   read back as zeroes. With normal L2 entries this is done with the
   QCOW_OFLAG_ZERO bit, whereas with extended L2 entries this is done
   with the individual 'all zeroes' bits for each subcluster.

   Note however that QCOW_OFLAG_ZERO is not supported in v2 qcow2
   images so, if there is a backing file, discard cannot guarantee
   that the image will read back as zeroes. If this is important for
   the caller it should forbid it as qcow2_co_pdiscard() does (see
   80f5c01183 for more details).

Signed-off-by: Alberto Garcia <berto@igalia.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-Id: <5ef8274e628aa3ab559bfac467abf488534f2b76.1594396418.git.berto@igalia.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
block/qcow2-cluster.c