Page MenuHomeFreeBSD

bhyve: virtio DISCARD doesn't work for 'sectorsize=512/4096'
ClosedPublic

Authored by gusev.vitaliy_gmail.com on Nov 3 2020, 1:58 PM.
Tags
Referenced Files
Unknown Object (File)
Thu, May 28, 2:50 AM
Unknown Object (File)
Wed, May 27, 11:09 PM
Unknown Object (File)
Wed, May 27, 10:50 PM
Unknown Object (File)
Mon, May 25, 10:32 AM
Unknown Object (File)
May 9 2026, 6:36 AM
Unknown Object (File)
Apr 10 2026, 1:09 PM
Unknown Object (File)
Mar 20 2026, 7:34 AM
Unknown Object (File)
Mar 19 2026, 5:50 AM

Details

Summary

If bhyve is used to emulate 512e access in guest OS, then discard addresses should be properly aligned. Otherwise ioctl DIOCGDELETE fails with 4K geom devices (look at g_dev_ioctl() in sys/geom/geom_dev.c).

So take into account the physical sector size as well.

Test Plan

Assign zvol with 4K volblocksize via geom to VM with different sector size argument: 512/4096, 4096/4096, etc.

All cases work fine with patch.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable