Skip to content

block: propagate discard alignment from format drivers to the guest

Denis V. Lunev qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 6 repliesIn review

Changes from v2 from the cover letter

- 172 iotest fixed

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2block: propagate discard alignment from format drivers to the guestblock/block-backend.c hw/core/machine.c hw/ide/qdev.c +3 more+38 -40 replies
2/2iotests: fix 172 testtests/qemu-iotests/172.out+53 -530 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] block: propagate discard alignment from format drivers to the guest

Nowaday SCSI drivers in guests are able to align UNMAP requests before sending to the device. Right now QEMU provides an ability to set this via "discard_granularity" property of the block device which could be used by management layer.

Though, in particular, from the point of QEMU, there is pdiscard_granularity on the format driver level, f.e. on QCOW2 or iSCSI. It would be beneficial to pass this value as a default for this property.

Technically this should reduce the amount of use less UNMAP requests from the guest to the host. Basic test confirms this. Fedora 31 guest during 'fstrim /' on 32 Gb disk has issued 401/415 requests with/without proper alignment to QEMU.

Changes from v2:
- 172 iotest fixed

Changes from v1:
- fixed typos in description
- added machine type compatibility layer as suggested by Kevin

CC Kevin Wolf <[email protected]>
CC Max Reitz <[email protected]>
CC Eduardo Habkost <[email protected]>
CC Marcel Apfelbaum <[email protected]>
CC John Snow <[email protected]>
CC Paolo Bonzini <[email protected]>
CC Fam Zheng <[email protected]>