Project

General

Profile

Actions

Bug #11471

closed

vioblk: vioblk IO is performed by 512B blocks

Added by Toomas Soome about 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
driver - device drivers
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
External Bug:

Description

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).

Actions #1

Updated by Joshua M. Clulow almost 4 years 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 ashift of 9.

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>
...

After running 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.

Actions #2

Updated by Electric Monk almost 4 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 90 to 100

git commit c5c712a873aaa2cebb338aa84cfb7748f5d4e641

commit  c5c712a873aaa2cebb338aa84cfb7748f5d4e641
Author: Toomas Soome <tsoome@me.com>
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 <yuri.pankov@nexenta.com>
    Reviewed by: Igor Kozhukhov <igor@dilos.org>
    Reviewed by: Hans Rosenfeld <hans.rosenfeld@joyent.com>
    Reviewed by: C Fraire <cfraire@me.com>
    Approved by: Joshua M. Clulow <josh@sysmgr.org>

Actions

Also available in: Atom PDF