[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 03/53] block/iscsi: set max_transfer_length
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 03/53] block/iscsi: set max_transfer_length |
Date: |
Mon, 3 Nov 2014 11:50:06 +0000 |
From: Peter Lieven <address@hidden>
Copy the max_xfer_len from the BlockLimits VPD or use the
maximum value fitting in the CDB.
The helper function sector_limits_lun2qemu is introduced to convert
and cap the limits from the VPD to the maximum power of two fitting
in an integer; integer is the range for nb_sectors throughout
the block layer.
Signed-off-by: Peter Lieven <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
block/iscsi.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/block/iscsi.c b/block/iscsi.c
index 233f462..6b229b1 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -1447,12 +1447,25 @@ static void iscsi_close(BlockDriverState *bs)
memset(iscsilun, 0, sizeof(IscsiLun));
}
-static void iscsi_refresh_limits(BlockDriverState *bs, Error **errp)
+static int sector_limits_lun2qemu(int64_t sector, IscsiLun *iscsilun)
{
- IscsiLun *iscsilun = bs->opaque;
+ return MIN(sector_lun2qemu(sector, iscsilun), INT_MAX / 2 + 1);
+}
+static void iscsi_refresh_limits(BlockDriverState *bs, Error **errp)
+{
/* We don't actually refresh here, but just return data queried in
* iscsi_open(): iscsi targets don't change their limits. */
+
+ IscsiLun *iscsilun = bs->opaque;
+ uint32_t max_xfer_len = iscsilun->use_16_for_rw ? 0xffffffff : 0xffff;
+
+ if (iscsilun->bl.max_xfer_len) {
+ max_xfer_len = MIN(max_xfer_len, iscsilun->bl.max_xfer_len);
+ }
+
+ bs->bl.max_transfer_length = sector_limits_lun2qemu(max_xfer_len,
iscsilun);
+
if (iscsilun->lbp.lbpu) {
if (iscsilun->bl.max_unmap < 0xffffffff) {
bs->bl.max_discard = sector_lun2qemu(iscsilun->bl.max_unmap,
--
1.9.3
- [Qemu-devel] [PULL 00/53] Block patches, Stefan Hajnoczi, 2014/11/03
- [Qemu-devel] [PULL 02/53] BlockLimits: introduce max_transfer_length, Stefan Hajnoczi, 2014/11/03
- [Qemu-devel] [PULL 01/53] util: introduce MIN_NON_ZERO, Stefan Hajnoczi, 2014/11/03
- [Qemu-devel] [PULL 03/53] block/iscsi: set max_transfer_length,
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 04/53] block: avoid creating oversized writes in multiwrite_merge, Stefan Hajnoczi, 2014/11/03
- [Qemu-devel] [PULL 05/53] block/iscsi: use sector_limits_lun2qemu throughout iscsi_refresh_limits, Stefan Hajnoczi, 2014/11/03
- [Qemu-devel] [PULL 06/53] block/iscsi: check for oversized requests, Stefan Hajnoczi, 2014/11/03
- [Qemu-devel] [PULL 07/53] ahci: Correct PIO/D2H FIS responses, Stefan Hajnoczi, 2014/11/03
- [Qemu-devel] [PULL 08/53] ahci: Update byte count after DMA completion, Stefan Hajnoczi, 2014/11/03
- [Qemu-devel] [PULL 09/53] ahci: Fix SDB FIS Construction, Stefan Hajnoczi, 2014/11/03
- [Qemu-devel] [PULL 10/53] snapshot: Reset err to NULL to avoid double free, Stefan Hajnoczi, 2014/11/03
- [Qemu-devel] [PULL 11/53] iotests: replace fake parallels image with authentic one, Stefan Hajnoczi, 2014/11/03
- [Qemu-devel] [PULL 12/53] iotests: add v2 parallels sample image and simple test for it, Stefan Hajnoczi, 2014/11/03
- [Qemu-devel] [PULL 13/53] block/parallels: fix access to not initialized memory in catalog_bitmap, Stefan Hajnoczi, 2014/11/03