From a9bf8d1acc8589ebda4fb96acd08822a7937af9b Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Paolo Bonzini Date: Mon, 9 Dec 2013 14:09:04 +0100 Subject: [PATCH 16/50] iscsi: set limits in BlockDriverState RH-Author: Paolo Bonzini 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 RH-Acked-by: Fam Zheng RH-Acked-by: Stefan Hajnoczi From: Peter Lieven Reviewed-by: Eric Blake Signed-off-by: Peter Lieven Signed-off-by: Stefan Hajnoczi (cherry picked from commit ba6c59191f245147e7ee0c2b9ecaf5fb116f7877) --- block/iscsi.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) Signed-off-by: Michal Novotny --- 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