bhyve: TRIM support in AHCI controller
Wanpeng Qian
wanpengqian at gmail.com
Thu Mar 19 12:55:51 UTC 2020
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.
More information about the freebsd-virtualization
mailing list