bdev_virtio: add SCSI READ/WRITE 16 support
Change-Id: I458dc865744ed2dd7fcf8e838029add090ff85fa Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/377170 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
43be836ae5
commit
2e1a8b6c2e
@ -137,15 +137,27 @@ bdev_virtio_rw(struct spdk_io_channel *ch, struct spdk_bdev_io *bdev_io)
|
||||
if (is_read) {
|
||||
vreq->iov = bdev_io->u.read.iovs;
|
||||
vreq->iovcnt = bdev_io->u.read.iovcnt;
|
||||
req->cdb[0] = SPDK_SBC_READ_10;
|
||||
to_be32(&req->cdb[2], bdev_io->u.read.offset_blocks);
|
||||
to_be16(&req->cdb[7], bdev_io->u.read.num_blocks);
|
||||
if (disk->num_blocks > (1ULL << 32)) {
|
||||
req->cdb[0] = SPDK_SBC_READ_16;
|
||||
to_be64(&req->cdb[2], bdev_io->u.read.offset_blocks);
|
||||
to_be32(&req->cdb[10], bdev_io->u.read.num_blocks);
|
||||
} else {
|
||||
req->cdb[0] = SPDK_SBC_READ_10;
|
||||
to_be32(&req->cdb[2], bdev_io->u.read.offset_blocks);
|
||||
to_be16(&req->cdb[7], bdev_io->u.read.num_blocks);
|
||||
}
|
||||
} else {
|
||||
vreq->iov = bdev_io->u.write.iovs;
|
||||
vreq->iovcnt = bdev_io->u.write.iovcnt;
|
||||
req->cdb[0] = SPDK_SBC_WRITE_10;
|
||||
to_be32(&req->cdb[2], bdev_io->u.write.offset_blocks);
|
||||
to_be16(&req->cdb[7], bdev_io->u.write.num_blocks);
|
||||
if (disk->num_blocks > (1ULL << 32)) {
|
||||
req->cdb[0] = SPDK_SBC_WRITE_16;
|
||||
to_be64(&req->cdb[2], bdev_io->u.write.offset_blocks);
|
||||
to_be32(&req->cdb[10], bdev_io->u.write.num_blocks);
|
||||
} else {
|
||||
req->cdb[0] = SPDK_SBC_WRITE_10;
|
||||
to_be32(&req->cdb[2], bdev_io->u.write.offset_blocks);
|
||||
to_be16(&req->cdb[7], bdev_io->u.write.num_blocks);
|
||||
}
|
||||
}
|
||||
|
||||
virtio_xmit_pkts(disk->vdev->vqs[2], vreq);
|
||||
|
Loading…
Reference in New Issue
Block a user