mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 17:23:56 -06:00
block: Give nonzero result to blk_get_max_transfer_length()
Making all callers special-case 0 as unlimited is awkward, and we DO have a hard maximum of BDRV_REQUEST_MAX_SECTORS given our current block layer API limits. In the case of scsi, this means that we now always advertise a limit to the guest, even in cases where the underlying layers previously use 0 for no inherent limit beyond the block layer. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
efaf4781a9
commit
24ce9a2026
3 changed files with 11 additions and 11 deletions
|
@ -227,12 +227,12 @@ static void scsi_read_complete(void * opaque, int ret)
|
|||
r->req.cmd.buf[2] == 0xb0) {
|
||||
uint32_t max_xfer_len = blk_get_max_transfer_length(s->conf.blk) /
|
||||
(s->blocksize / BDRV_SECTOR_SIZE);
|
||||
if (max_xfer_len) {
|
||||
stl_be_p(&r->buf[8], max_xfer_len);
|
||||
/* Also take care of the opt xfer len. */
|
||||
if (ldl_be_p(&r->buf[12]) > max_xfer_len) {
|
||||
stl_be_p(&r->buf[12], max_xfer_len);
|
||||
}
|
||||
|
||||
assert(max_xfer_len);
|
||||
stl_be_p(&r->buf[8], max_xfer_len);
|
||||
/* Also take care of the opt xfer len. */
|
||||
if (ldl_be_p(&r->buf[12]) > max_xfer_len) {
|
||||
stl_be_p(&r->buf[12], max_xfer_len);
|
||||
}
|
||||
}
|
||||
scsi_req_data(&r->req, len);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue