[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 07/43] iscsi: Advertise realistic limits to block lay
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 07/43] iscsi: Advertise realistic limits to block layer |
Date: |
Tue, 5 Jul 2016 17:50:16 +0200 |
From: Eric Blake <address@hidden>
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 <address@hidden>
Reviewed-by: Kevin Wolf <address@hidden>
Reviewed-by: Fam Zheng <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/iscsi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/block/iscsi.c b/block/iscsi.c
index 9bb5ff6..c5dedb3 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)
--
1.8.3.1
- [Qemu-block] [PULL 00/43] Block layer patches, Kevin Wolf, 2016/07/05
- [Qemu-block] [PULL 01/43] qemu-img: fix failed autotests, Kevin Wolf, 2016/07/05
- [Qemu-block] [PULL 03/43] block: Document supported flags during bdrv_aligned_preadv(), Kevin Wolf, 2016/07/05
- [Qemu-block] [PULL 04/43] block: Fix harmless off-by-one in bdrv_aligned_preadv(), Kevin Wolf, 2016/07/05
- [Qemu-block] [PULL 05/43] nbd: Allow larger requests, Kevin Wolf, 2016/07/05
- [Qemu-block] [PULL 07/43] iscsi: Advertise realistic limits to block layer,
Kevin Wolf <=
- [Qemu-block] [PULL 02/43] block: Tighter assertions on bdrv_aligned_pwritev(), Kevin Wolf, 2016/07/05
- [Qemu-block] [PULL 08/43] scsi: Advertise limits by blocksize, not 512, Kevin Wolf, 2016/07/05
- [Qemu-block] [PULL 06/43] nbd: Advertise realistic limits to block layer, Kevin Wolf, 2016/07/05
- [Qemu-block] [PULL 09/43] block: Give nonzero result to blk_get_max_transfer_length(), Kevin Wolf, 2016/07/05
- [Qemu-block] [PULL 11/43] iscsi: Set request_alignment during .bdrv_refresh_limits(), Kevin Wolf, 2016/07/05
- [Qemu-block] [PULL 10/43] blkdebug: Set request_alignment during .bdrv_refresh_limits(), Kevin Wolf, 2016/07/05
- [Qemu-block] [PULL 12/43] qcow2: Set request_alignment during .bdrv_refresh_limits(), Kevin Wolf, 2016/07/05
- [Qemu-block] [PULL 13/43] raw-win32: Set request_alignment during .bdrv_refresh_limits(), Kevin Wolf, 2016/07/05
- [Qemu-block] [PULL 16/43] block: Switch transfer length bounds to byte-based, Kevin Wolf, 2016/07/05
- [Qemu-block] [PULL 14/43] block: Set request_alignment during .bdrv_refresh_limits(), Kevin Wolf, 2016/07/05