Daniel Henrique Barboza d082d16a5c scsi-disk.c: consider bl->max_transfer in INQUIRY emulation
The calculation of the max_transfer atribute of BlockDriverState
makes considerations such as max_segments and transfer_length via
the BLKSECTGET ioctl (if available).

However, bl->max_transfer isn't considered when emulating the INQUIRY
'Block Limit' response to the scsi-hd devices. This leads to situations
where the declared max_sectors from the INQUIRY response is inconsistent
with the block limits, which isn't ideal. It can also be misleading to the
user that sets /sys/block/<dev>/queue/max_sectors_kb to a certain
value, then finds a different value in the guest OS for the same disk.

Following the same logic scsi_read_complete from scsi-generic.c does
when patching the response of the Block Limits VPD back to the guest,
change the max_io_sectors value of the emulated Block Limits VPD
response by considering the blk_get_max_transfer of the related
BlockDriverState. Use MIN_NOT_ZERO to be sure that the minimal
value is chosen.

Given that we're changing max_io_sectors, consider that min_io_sectors
and opt_io_sectors can't be greater than the new calculated value.

Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Message-Id: <20180306154411.18462-1-danielhb@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2018-03-12 16:12:45 +01:00
..
2018-03-02 13:45:50 -06:00
2018-03-08 15:49:23 +01:00
2018-03-01 11:05:45 +00:00
2018-03-12 16:12:45 +01:00
2018-03-02 13:45:50 -06:00
2018-03-05 14:27:24 +00:00
2018-03-07 08:30:28 +13:00
2018-03-09 17:09:45 +00:00
2018-03-02 13:45:50 -06:00
2018-03-08 12:56:39 +00:00
2018-03-02 13:45:50 -06:00
2018-03-02 13:45:50 -06:00