diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2012-01-27 08:58:52 -0600 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2012-01-27 08:58:52 -0600 |
commit | 21fe5bc678b16d748db385fb1be95caa96b00eee (patch) | |
tree | 33342168c916f107f2c1e89c8fff8490b9e46f88 /hw | |
parent | 96bab41df61b532bb6954a38527ad8403859a6c9 (diff) | |
parent | e2f0c49ffae8d3a00272c3cbc68850cc5aafbffa (diff) | |
download | qemu-21fe5bc678b16d748db385fb1be95caa96b00eee.tar.gz qemu-21fe5bc678b16d748db385fb1be95caa96b00eee.tar.bz2 qemu-21fe5bc678b16d748db385fb1be95caa96b00eee.zip |
Merge remote-tracking branch 'kwolf/for-anthony' into staging
* kwolf/for-anthony: (22 commits)
scsi: Guard against buflen exceeding req->cmd.xfer in scsi_disk_emulate_command
qcow: Use bdrv functions to replace file operation
qcow: Return real error code in qcow_open
block/vdi: Zero unused parts when allocating a new block (fix #919242)
virtio-blk: add virtio_blk_handle_read trace event
docs: describe live block operations
block: add support for partial streaming
add QERR_BASE_NOT_FOUND
block: add bdrv_find_backing_image
blockdev: make image streaming safe across hotplug
qmp: add query-block-jobs
qmp: add block_job_cancel command
qmp: add block_job_set_speed command
qmp: add block_stream command
block: rate-limit streaming operations
block: add image streaming block job
block: add BlockJob interface for long-running operations
block: make copy-on-read a per-request flag
block: check bdrv_in_use() before blockdev operations
coroutine: add co_sleep_ns() coroutine sleep function
...
Diffstat (limited to 'hw')
-rw-r--r-- | hw/scsi-disk.c | 10 | ||||
-rw-r--r-- | hw/virtio-blk.c | 2 |
2 files changed, 3 insertions, 9 deletions
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index 5d8bf53586..11cfe73df8 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -391,9 +391,6 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf) } l = strlen(s->serial); - if (l > req->cmd.xfer) { - l = req->cmd.xfer; - } if (l > 20) { l = 20; } @@ -1002,9 +999,6 @@ static int scsi_disk_emulate_mode_sense(SCSIDiskReq *r, uint8_t *outbuf) outbuf[0] = ((buflen - 2) >> 8) & 0xff; outbuf[1] = (buflen - 2) & 0xff; } - if (buflen > r->req.cmd.xfer) { - buflen = r->req.cmd.xfer; - } return buflen; } @@ -1038,9 +1032,6 @@ static int scsi_disk_emulate_read_toc(SCSIRequest *req, uint8_t *outbuf) default: return -1; } - if (toclen > req->cmd.xfer) { - toclen = req->cmd.xfer; - } return toclen; } @@ -1251,6 +1242,7 @@ static int scsi_disk_emulate_command(SCSIDiskReq *r) scsi_check_condition(r, SENSE_CODE(INVALID_OPCODE)); return -1; } + buflen = MIN(buflen, req->cmd.xfer); return buflen; not_ready: diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c index 5b416c36ee..a5a439668b 100644 --- a/hw/virtio-blk.c +++ b/hw/virtio-blk.c @@ -346,6 +346,8 @@ static void virtio_blk_handle_read(VirtIOBlockReq *req) bdrv_acct_start(req->dev->bs, &req->acct, req->qiov.size, BDRV_ACCT_READ); + trace_virtio_blk_handle_read(req, sector, req->qiov.size / 512); + if (sector & req->dev->sector_mask) { virtio_blk_rw_complete(req, -EIO); return; |