Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Mar 2020 21:54:59 +0900
From:      Wanpeng Qian <wanpengqian@gmail.com>
To:        FreeBSD virtualization <freebsd-virtualization@freebsd.org>
Subject:   bhyve: TRIM support in AHCI controller
Message-ID:  <CANBJ%2BxRW2F6U5_=p%2B_k33=1mvSfoONgNKtGF3T=2Ry%2B1fV_R=Q@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi all

I found the output of diskinfo inside VM of AHCI disk as follow, no
TRIM support.
root@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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANBJ%2BxRW2F6U5_=p%2B_k33=1mvSfoONgNKtGF3T=2Ry%2B1fV_R=Q>