Commit 2e1a8b6c authored by Dariusz Stojaczyk's avatar Dariusz Stojaczyk Committed by Daniel Verkamp
Browse files

bdev_virtio: add SCSI READ/WRITE 16 support

parent 43be836a
Loading
Loading
Loading
Loading
+18 −6
Original line number Diff line number Diff line
@@ -137,16 +137,28 @@ 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;
		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;
		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);
}