Skip to content

add TRIM/UNMAP support

Christoph Hellwig qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 16 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5block: add discard supportblock.c block.h block/raw.c +1 more+20 -12 replies
1/5block: add discard supportblock.c block.h block/raw.c +1 more+22 -18 replies
2/5scsi-disk: support WRITE SAME (16) with unmap bithw/scsi-defs.h hw/scsi-disk.c+48 -11 reply
2/5scsi-disk: support WRITE SAME (16) with unmap bithw/scsi-defs.h hw/scsi-disk.c+50 -20 replies
3/5make dma_bdrv_io available to driversdma-helpers.c dma.h+18 -130 replies
3/5make dma_bdrv_io available to driversdma-helpers.c dma.h+18 -130 replies
4/5ide: add TRIM supporthw/ide/core.c hw/ide/internal.h hw/ide/qdev.c+150 -11 reply
4/5ide: add TRIM supporthw/ide/core.c hw/ide/internal.h hw/ide/qdev.c+150 -12 replies
5/5raw-posix: add discard supportblock/raw-posix.c configure+70 -00 replies
5/5raw-posix: add discard supportblock/raw-posix.c configure+70 -01 reply

Reviews trailers per patch

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

Read the v1 thread

Cover letter [Qemu-devel] [PATCH 0/5] add TRIM/UNMAP support

This patchset adds support for the ATA TRIM and SCSI WRITE SAME with unmap commands, which allow reclaiming free space from a backing image.

The user facing implementation is pretty complete, but not really efficient because the underlying bdrv_discard implementation doesn't use the aio implementation yet. The reason for that is that the SCSI layer doesn't really allow any asynchronous commands except for READ/WRITE by design, and implementing the ATA TRIM command with it's multiple ranges is rather painful, and combined with the SCSI limitation I didn't bother yet. The only backend support so far is the XFS hole punching ioctl, but others can be added easily when they become available. A virtio implementation for a discard command would also be pretty easy, but until we actually support a better backend then a plain sparse file it's not worth using for production enviroments anyway, but more for playing with the thin provisioning infrastructure, or observing guest behaviour when TRIM / unmap is supported.

If the support is enabled and the backend doesn't support hole punching the TRIM / WRITE SAME commands become no-ops so that migration from hosts supporting or not supporting it works.