diff options
author | Toomas Soome <tsoome@me.com> | 2019-07-15 15:12:31 +0300 |
---|---|---|
committer | Toomas Soome <tsoome@me.com> | 2019-10-06 22:44:48 +0300 |
commit | c5c712a873aaa2cebb338aa84cfb7748f5d4e641 (patch) | |
tree | 6296bc01b0d03751dd3ed4a56413de1ba50468a8 | |
parent | 53b8aa11a4b4383655db95e7986c9d5c191e507d (diff) | |
download | illumos-joyent-c5c712a873aaa2cebb338aa84cfb7748f5d4e641.tar.gz |
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>
-rw-r--r-- | usr/src/uts/common/io/vioblk/vioblk.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/usr/src/uts/common/io/vioblk/vioblk.c b/usr/src/uts/common/io/vioblk/vioblk.c index 8801a0e760..df1d1d6dd4 100644 --- a/usr/src/uts/common/io/vioblk/vioblk.c +++ b/usr/src/uts/common/io/vioblk/vioblk.c @@ -243,7 +243,7 @@ vioblk_common_start(vioblk_t *vib, int type, uint64_t sector, struct vioblk_req_hdr vbh; vbh.vbh_type = type; vbh.vbh_ioprio = 0; - vbh.vbh_sector = sector; + vbh.vbh_sector = (sector * vib->vib_blk_size) / DEV_BSIZE; bcopy(&vbh, virtio_dma_va(vbr->vbr_dma, 0), sizeof (vbh)); virtio_chain_data_set(vic, vbr); @@ -536,7 +536,7 @@ vioblk_bd_mediainfo(void *arg, bd_media_t *media) * larger. */ media->m_nblks = vib->vib_nblks; - media->m_blksize = DEV_BSIZE; + media->m_blksize = vib->vib_blk_size; media->m_readonly = vib->vib_readonly; media->m_pblksize = vib->vib_pblk_size; @@ -871,6 +871,12 @@ vioblk_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) } /* + * Device capacity is always in 512-byte units, convert to + * native blocks. + */ + vib->vib_nblks = (vib->vib_nblks * DEV_BSIZE) / vib->vib_blk_size; + + /* * The device may also provide an advisory physical block size. */ vib->vib_pblk_size = vib->vib_blk_size; |