240766
From 0be3bd54babffebdc68e274a926ccecb77b2537c Mon Sep 17 00:00:00 2001
240766
From: Fam Zheng <famz@redhat.com>
240766
Date: Fri, 4 Apr 2014 05:56:02 +0200
240766
Subject: [PATCH 07/12] iscsi: always query max WRITE SAME length
240766
240766
RH-Author: Fam Zheng <famz@redhat.com>
240766
Message-id: <1396590962-25815-8-git-send-email-famz@redhat.com>
240766
Patchwork-id: 58344
240766
O-Subject: [RHEL-7 0day qemu-kvm PATCH 7/7] iscsi: always query max WRITE SAME length
240766
Bugzilla: 1090978
240766
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
240766
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
240766
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
240766
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
240766
240766
From: Paolo Bonzini <pbonzini@redhat.com>
240766
240766
Max WRITE SAME length is also used when the UNMAP bit is zero, so it
240766
should be queried even if LBPWS=0.  Same for the optimal transfer
240766
length.
240766
240766
However, the write_zeroes_alignment only matters for UNMAP=1 so we
240766
still restrict it to LBPWS=1.
240766
240766
Reviewed-by: Peter Lieven <pl@kamp.de>
240766
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
240766
(cherry picked from commit c97ca29db0a68deb281a901f535cec5ea4862244)
240766
Signed-off-by: Fam Zheng <famz@redhat.com>
240766
---
240766
 block/iscsi.c | 12 +++++++-----
240766
 1 file changed, 7 insertions(+), 5 deletions(-)
240766
240766
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
240766
---
240766
 block/iscsi.c |   12 +++++++-----
240766
 1 files changed, 7 insertions(+), 5 deletions(-)
240766
240766
diff --git a/block/iscsi.c b/block/iscsi.c
240766
index b80ebd3..78ab91e 100644
240766
--- a/block/iscsi.c
240766
+++ b/block/iscsi.c
240766
@@ -1510,18 +1510,20 @@ static int iscsi_refresh_limits(BlockDriverState *bs)
240766
 
240766
     /* We don't actually refresh here, but just return data queried in
240766
      * iscsi_open(): iscsi targets don't change their limits. */
240766
-    if (iscsilun->lbp.lbpu || iscsilun->lbp.lbpws) {
240766
+    if (iscsilun->lbp.lbpu) {
240766
         if (iscsilun->bl.max_unmap < 0xffffffff) {
240766
             bs->bl.max_discard = sector_lun2qemu(iscsilun->bl.max_unmap,
240766
                                                  iscsilun);
240766
         }
240766
         bs->bl.discard_alignment = sector_lun2qemu(iscsilun->bl.opt_unmap_gran,
240766
                                                    iscsilun);
240766
+    }
240766
 
240766
-        if (iscsilun->bl.max_ws_len < 0xffffffff) {
240766
-            bs->bl.max_write_zeroes = sector_lun2qemu(iscsilun->bl.max_ws_len,
240766
-                                                      iscsilun);
240766
-        }
240766
+    if (iscsilun->bl.max_ws_len < 0xffffffff) {
240766
+        bs->bl.max_write_zeroes = sector_lun2qemu(iscsilun->bl.max_ws_len,
240766
+                                                  iscsilun);
240766
+    }
240766
+    if (iscsilun->lbp.lbpws) {
240766
         bs->bl.write_zeroes_alignment = sector_lun2qemu(iscsilun->bl.opt_unmap_gran,
240766
                                                         iscsilun);
240766
 
240766
-- 
240766
1.7.1
240766