vioblk: vioblk IO is performed by 512B blocks
Even as the device is reporting different logical block sizes, the starting sector and block sizes are assumed to be in 512B units for reads and writes.
Tested with bhyve virtio and sector sizes 512B, 4k and 8k. (Did create whole disk zfs pools and did verify partition table and pool access).
Updated by Joshua M. Clulow 4 months ago
Testing Notes (Supplemental)¶
I installed OpenIndiana in a QEMU/KVM guest on an Ubuntu system. By default,
virt-manager doesn't allow you to adjust the block size, so the device was a 512 byte native Virtio block device. The root pool was created with
I was able to edit
/etc/libvirt/qemu/$GUESTNAME.xml to edit the disk object to act like a 512e device (512 logical, 4096 physical):
... <disk type='file' device='disk'> <driver name='qemu' type='qcow2'/> <source file='/var/lib/libvirt/images/generic-3-1.qcow2'/> <blockio logical_block_size='512' physical_block_size='4096'/> <target dev='vda' bus='virtio'/> <boot order='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/> </disk> ...
systemctl restart libvirtd I restarted the guest and was able to boot it.
I added a second disk (size 4GB) and made it 4k native using the same procedure. Looking inside the guest:
root@openindiana:~# diskinfo TYPE DISK VID PID SIZE RMV SSD - c4t0d0 Virtio Block Device 20.00 GiB no no - c6t0d0 Virtio Block Device 4.00 GiB no no root@openindiana:~# mdb -ke '::prtconf -d vioblk | ::devinfo -d | ::printf "%p: %5d %5d %d\n" vioblk_t . vib_blk_size vib_pblk_size vib_nblks' ffffff0186a83680: 512 4096 41943040 ffffff018e239a80: 4096 4096 1048576 root@openindiana:~# zpool create extra c6t0d0 root@openindiana:~# zdb extra | grep ashift ashift: 12 ashift: 12 ...
The 4GB capacity for the 4k native device is correctly reflected in both
diskinfo and in the block size. I copied some data into the pool and completed a successful scrub.
Updated by Electric Monk 4 months ago
- Status changed from In Progress to Closed
- % Done changed from 90 to 100
commit c5c712a873aaa2cebb338aa84cfb7748f5d4e641 Author: Toomas Soome <firstname.lastname@example.org> Date: 2019-10-06T19:44:48.000Z 11470 vioblk: device capacity is always returned in 512B units 11471 vioblk: vioblk IO is performed by 512B blocks Reviewed by: Yuri Pankov <email@example.com> Reviewed by: Igor Kozhukhov <firstname.lastname@example.org> Reviewed by: Hans Rosenfeld <email@example.com> Reviewed by: C Fraire <firstname.lastname@example.org> Approved by: Joshua M. Clulow <email@example.com>