bhyve: TRIM support in AHCI controller

John-Mark Gurney jmg at funkthat.com
Mon Apr 13 01:43:50 UTC 2020


Allan Jude wrote this message on Sat, Apr 11, 2020 at 11:15 -0400:
> On 2020-03-19 08:54, Wanpeng Qian wrote:
> > Hi all
> > 
> > I found the output of diskinfo inside VM of AHCI disk as follow, no
> > TRIM support.
> > root at smart:~ #  diskinfo -v ada0
> > ada0
> > 512          # sectorsize
> > 21474836480 # mediasize in bytes (20G)
> > 41943040    # mediasize in sectors
> > 131072      # stripesize
> > 0            # stripeoffset
> > 41610        # Cylinders according to firmware.
> > 16          # Heads according to firmware.
> > 63          # Sectors according to firmware.
> > BHYVE SATA DISK # Disk descr.
> > BHYVE-0B98-104F-E9A7 # Disk ident.
> > No          # TRIM/UNMAP support
> > 0            # Rotation rate in RPM
> > Not_Zoned    # Zone Mode
> > 
> > Also camcontrol identify ada0 -v show not support of TRIM
> > 
> > Data Set Management (DSM/TRIM) no
> > 
> > I check to pci_ahci.c, TRIM support is decided by block_if.c's candelete flag.
> > while candelete is decided here
> > 
> >                 strlcpy(arg.name, "GEOM::candelete", sizeof(arg.name));
> >                 arg.len = sizeof(arg.value.i);
> >                 if (ioctl(fd, DIOCGATTR, &arg) == 0)
> >                         candelete = arg.value.i;
> > 
> > Obvious file backend will not have the candelete flag.
> > 
> > If the backend storage support TRIM, I think we should present TRIM
> > ability to VM.
> > Any better idea to check whether backend storage support TRIM or not,
> > so we can enable it.
> > 
> > Thanks.
> > _______________________________________________
> > freebsd-virtualization at freebsd.org mailing list
> > https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
> > To unsubscribe, send any mail to "freebsd-virtualization-unsubscribe at freebsd.org"
> > 
> 
> I have updated my patch to add TRIM support to the bhyve block interface
> here:
> 
> https://reviews.freebsd.org/D21707
> 
> I am working on an update to the virtio driver, to make FreeBSD guests
> able to TRIM if the hypervisor supports it as well:
> 
> https://reviews.freebsd.org/D21708

One comment on that patch is that it looks like there are a number of
white space and definitions (unrelated to the patch) that are included
in the patch.  It'd be good to break out those fixes and just commit
them..  That would reduce the size of the patch a bit.

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-virtualization/attachments/20200412/71fa07fa/attachment.sig>


More information about the freebsd-virtualization mailing list