]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r360229, r363255
authorAllan Jude <allanjude@FreeBSD.org>
Sun, 13 Sep 2020 23:51:07 +0000 (23:51 +0000)
committerAllan Jude <allanjude@FreeBSD.org>
Sun, 13 Sep 2020 23:51:07 +0000 (23:51 +0000)
commit4e5ba9e475fb3e006664144bd752d39e4dd0c2bb
treeaf992f8c8d54b2e9238b4e7401f870686e5b8d01
parent9de96f982db3a565fb92dd2e894227c53b3d24ac
MFC r360229, r363255
MFS r365614

r360229:
Add VIRTIO_BLK_T_DISCARD (TRIM) support to the bhyve virtio-blk backend

This will advertise support for TRIM to the guest virtio-blk driver and
perform the DIOCGDELETE ioctl on the backing storage if it supports it.

Thanks to Jason King and others at Joyent and illumos for expanding on
my original patch, adding improvements including better error handling
and making sure to following the virtio spec.

r363255:
Add VIRTIO_BLK_T_DISCARD support to the virtio-blk driver

If the hypervisor advertises support for the DISCARD command then the
guest can perform TRIM commands, freeing space on the backing store.

If VIRTIO_BLK_F_DISCARD is enabled, advertise DISKFLAG_CANDELETE

Tested with FreeBSD guests on bhyve and KVM

Approved by: re (gjb)
Relnotes: yes
Sponsored by: Klara Inc.
sys/dev/virtio/block/virtio_blk.c
sys/dev/virtio/block/virtio_blk.h
usr.sbin/bhyve/block_if.c
usr.sbin/bhyve/pci_virtio_block.c