From a9bf8d1acc8589ebda4fb96acd08822a7937af9b Mon Sep 17 00:00:00 2001
Message-Id: <a9bf8d1acc8589ebda4fb96acd08822a7937af9b.1389014116.git.minovotn@redhat.com>
In-Reply-To: <c8cc35838d42aa286242772d97e3a9be7bb786ba.1389014116.git.minovotn@redhat.com>
References: <c8cc35838d42aa286242772d97e3a9be7bb786ba.1389014116.git.minovotn@redhat.com>
From: Paolo Bonzini <pbonzini@redhat.com>
Date: Mon, 9 Dec 2013 14:09:04 +0100
Subject: [PATCH 16/50] iscsi: set limits in BlockDriverState
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
Message-id: <1386598178-11845-19-git-send-email-pbonzini@redhat.com>
Patchwork-id: 56055
O-Subject: [RHEL 7.0 qemu-kvm PATCH 18/52] iscsi: set limits in BlockDriverState
Bugzilla: 1007815
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
RH-Acked-by: Fam Zheng <famz@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
From: Peter Lieven <pl@kamp.de>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit ba6c59191f245147e7ee0c2b9ecaf5fb116f7877)
---
block/iscsi.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
block/iscsi.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/block/iscsi.c b/block/iscsi.c
index 1e8a2bb..e5f4670 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -1386,6 +1386,20 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
sizeof(struct scsi_inquiry_block_limits));
scsi_free_scsi_task(task);
task = NULL;
+
+ if (iscsilun->bl.max_unmap < 0xffffffff) {
+ bs->bl.max_discard = sector_lun2qemu(iscsilun->bl.max_unmap,
+ iscsilun);
+ }
+ bs->bl.discard_alignment = sector_lun2qemu(iscsilun->bl.opt_unmap_gran,
+ iscsilun);
+
+ if (iscsilun->bl.max_ws_len < 0xffffffff) {
+ bs->bl.max_write_zeroes = sector_lun2qemu(iscsilun->bl.max_ws_len,
+ iscsilun);
+ }
+ bs->bl.write_zeroes_alignment = sector_lun2qemu(iscsilun->bl.opt_unmap_gran,
+ iscsilun);
}
#if defined(LIBISCSI_FEATURE_NOP_COUNTER)
--
1.7.11.7