thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
9ae3a8
From 7e4a1d08c448ddbd6e20705cd2ea38b78f833401 Mon Sep 17 00:00:00 2001
9ae3a8
Message-Id: <7e4a1d08c448ddbd6e20705cd2ea38b78f833401.1389014116.git.minovotn@redhat.com>
9ae3a8
In-Reply-To: <c8cc35838d42aa286242772d97e3a9be7bb786ba.1389014116.git.minovotn@redhat.com>
9ae3a8
References: <c8cc35838d42aa286242772d97e3a9be7bb786ba.1389014116.git.minovotn@redhat.com>
9ae3a8
From: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
Date: Mon, 9 Dec 2013 14:09:33 +0100
9ae3a8
Subject: [PATCH 45/50] block/iscsi: set bdi->cluster_size
9ae3a8
9ae3a8
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
Message-id: <1386598178-11845-48-git-send-email-pbonzini@redhat.com>
9ae3a8
Patchwork-id: 56083
9ae3a8
O-Subject: [RHEL 7.0 qemu-kvm PATCH 47/52] block/iscsi: set bdi->cluster_size
9ae3a8
Bugzilla: 1007815
9ae3a8
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
9ae3a8
RH-Acked-by: Fam Zheng <famz@redhat.com>
9ae3a8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
9ae3a8
From: Peter Lieven <pl@kamp.de>
9ae3a8
9ae3a8
this patch aims to set bdi->cluster_size to the internal page size
9ae3a8
of the iscsi target so that enabled callers can align requests
9ae3a8
properly.
9ae3a8
9ae3a8
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
Signed-off-by: Peter Lieven <pl@kamp.de>
9ae3a8
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
(cherry picked from commit 1c0704a556dbb004a3b82791779760f418053951)
9ae3a8
---
9ae3a8
 block/iscsi.c | 7 +++++++
9ae3a8
 1 file changed, 7 insertions(+)
9ae3a8
9ae3a8
Signed-off-by: Michal Novotny <minovotn@redhat.com>
9ae3a8
---
9ae3a8
 block/iscsi.c | 7 +++++++
9ae3a8
 1 file changed, 7 insertions(+)
9ae3a8
9ae3a8
diff --git a/block/iscsi.c b/block/iscsi.c
9ae3a8
index 8b82fe7..94c5af8 100644
9ae3a8
--- a/block/iscsi.c
9ae3a8
+++ b/block/iscsi.c
9ae3a8
@@ -1582,6 +1582,13 @@ static int iscsi_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
9ae3a8
     IscsiLun *iscsilun = bs->opaque;
9ae3a8
     bdi->unallocated_blocks_are_zero = !!iscsilun->lbprz;
9ae3a8
     bdi->can_write_zeroes_with_unmap = iscsilun->lbprz && iscsilun->lbp.lbpws;
9ae3a8
+    /* Guess the internal cluster (page) size of the iscsi target by the means
9ae3a8
+     * of opt_unmap_gran. Transfer the unmap granularity only if it has a
9ae3a8
+     * reasonable size for bdi->cluster_size */
9ae3a8
+    if (iscsilun->bl.opt_unmap_gran * iscsilun->block_size >= 64 * 1024 &&
9ae3a8
+        iscsilun->bl.opt_unmap_gran * iscsilun->block_size <= 16 * 1024 * 1024) {
9ae3a8
+        bdi->cluster_size = iscsilun->bl.opt_unmap_gran * iscsilun->block_size;
9ae3a8
+    }
9ae3a8
     return 0;
9ae3a8
 }
9ae3a8
 
9ae3a8
-- 
9ae3a8
1.7.11.7
9ae3a8