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)
Sat, Oct 4, 4:33 AM
Unknown Object (File)
Sat, Sep 20, 12:07 AM
Unknown Object (File)
Fri, Sep 19, 7:59 AM
Unknown Object (File)
Aug 2 2025, 10:34 PM
Unknown Object (File)
Aug 2 2025, 10:45 AM
Unknown Object (File)
Jul 25 2025, 4:09 AM
Unknown Object (File)
Jul 23 2025, 1:15 PM
Unknown Object (File)
Jul 15 2025, 3:21 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