summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Blake <eblake@redhat.com>2016-06-23 16:37:10 -0600
committerKevin Wolf <kwolf@redhat.com>2016-07-05 16:46:25 +0200
commitf9e95af0a6be281f56ecc8413ea4a3ac3545ce17 (patch)
treed9bcbcb304a8a3f43e57aecb3051d11579a45d9e
parent202204717a7e73971cccebd38c5d8ac4b0bfcef8 (diff)
downloadqemu-f9e95af0a6be281f56ecc8413ea4a3ac3545ce17.tar.gz
qemu-f9e95af0a6be281f56ecc8413ea4a3ac3545ce17.tar.bz2
qemu-f9e95af0a6be281f56ecc8413ea4a3ac3545ce17.zip
iscsi: Advertise realistic limits to block layer
The function sector_limits_lun2qemu() returns a value in units of the block layer's 512-byte sector, and can be as large as 0x40000000, which is much larger than the block layer's inherent limit of BDRV_REQUEST_MAX_SECTORS. The block layer already handles '0' as a synonym to the inherent limit, and it is nicer to return this value than it is to calculate an arbitrary maximum, for two reasons: we want to ensure that the block layer continues to special-case '0' as 'no limit beyond the inherent limits'; and we want to be able to someday expand the block layer to allow 64-bit limits, where auditing for uses of BDRV_REQUEST_MAX_SECTORS will help us make sure we aren't artificially constraining iscsi to old block layer limits. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--block/iscsi.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/block/iscsi.c b/block/iscsi.c
index 9bb5ff6216..c5dedb3407 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -1698,7 +1698,9 @@ static void iscsi_close(BlockDriverState *bs)
static int sector_limits_lun2qemu(int64_t sector, IscsiLun *iscsilun)
{
- return MIN(sector_lun2qemu(sector, iscsilun), INT_MAX / 2 + 1);
+ int limit = MIN(sector_lun2qemu(sector, iscsilun), INT_MAX / 2 + 1);
+
+ return limit < BDRV_REQUEST_MAX_SECTORS ? limit : 0;
}
static void iscsi_refresh_limits(BlockDriverState *bs, Error **errp)