thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
9ae3a8
From 56adc601b22b81ae4c681af6b13f38e560f16867 Mon Sep 17 00:00:00 2001
9ae3a8
From: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Date: Wed, 11 Dec 2013 19:50:32 +0100
9ae3a8
Subject: [PATCH 04/37] block: Inherit opt_transfer_length
9ae3a8
MIME-Version: 1.0
9ae3a8
Content-Type: text/plain; charset=UTF-8
9ae3a8
Content-Transfer-Encoding: 8bit
9ae3a8
9ae3a8
Message-id: <1392117622-28812-5-git-send-email-kwolf@redhat.com>
9ae3a8
Patchwork-id: 57169
9ae3a8
O-Subject: [RHEL-7.0 qemu-kvm PATCH v2 04/37] block: Inherit opt_transfer_length
9ae3a8
Bugzilla: 748906
9ae3a8
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
9ae3a8
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
9ae3a8
RH-Acked-by: Max Reitz <mreitz@redhat.com>
9ae3a8
9ae3a8
When there is a format driver between the backend, it's not guaranteed
9ae3a8
that exposing the opt_transfer_length for the format driver results in
9ae3a8
the optimal requests (because of fragmentation etc.), but it can't make
9ae3a8
things worse, so let's just do it.
9ae3a8
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
Reviewed-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
9ae3a8
Reviewed-by: Max Reitz <mreitz@redhat.com>
9ae3a8
Reviewed-by: BenoƮt Canet <benoit@irqsave.net>
9ae3a8
(cherry picked from commit 466ad822deef3a03757d505218a52993c5d56b5d)
9ae3a8
9ae3a8
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
9ae3a8
---
9ae3a8
 block.c | 20 +++++++++++++++++++-
9ae3a8
 1 file changed, 19 insertions(+), 1 deletion(-)
9ae3a8
---
9ae3a8
 block.c |   20 +++++++++++++++++++-
9ae3a8
 1 files changed, 19 insertions(+), 1 deletions(-)
9ae3a8
9ae3a8
diff --git a/block.c b/block.c
9ae3a8
index 26eebcc..8b36d05 100644
9ae3a8
--- a/block.c
9ae3a8
+++ b/block.c
9ae3a8
@@ -452,7 +452,25 @@ static int bdrv_refresh_limits(BlockDriverState *bs)
9ae3a8
 
9ae3a8
     memset(&bs->bl, 0, sizeof(bs->bl));
9ae3a8
 
9ae3a8
-    if (drv && drv->bdrv_refresh_limits) {
9ae3a8
+    if (!drv) {
9ae3a8
+        return 0;
9ae3a8
+    }
9ae3a8
+
9ae3a8
+    /* Take some limits from the children as a default */
9ae3a8
+    if (bs->file) {
9ae3a8
+        bdrv_refresh_limits(bs->file);
9ae3a8
+        bs->bl.opt_transfer_length = bs->file->bl.opt_transfer_length;
9ae3a8
+    }
9ae3a8
+
9ae3a8
+    if (bs->backing_hd) {
9ae3a8
+        bdrv_refresh_limits(bs->backing_hd);
9ae3a8
+        bs->bl.opt_transfer_length =
9ae3a8
+            MAX(bs->bl.opt_transfer_length,
9ae3a8
+                bs->backing_hd->bl.opt_transfer_length);
9ae3a8
+    }
9ae3a8
+
9ae3a8
+    /* Then let the driver override it */
9ae3a8
+    if (drv->bdrv_refresh_limits) {
9ae3a8
         return drv->bdrv_refresh_limits(bs);
9ae3a8
     }
9ae3a8
 
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8