cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
34b321
From fea907b6897cb3e644dcee3c537ce6e64d7850ed Mon Sep 17 00:00:00 2001
34b321
From: Fam Zheng <famz@redhat.com>
34b321
Date: Mon, 11 Jul 2016 05:33:35 +0200
34b321
Subject: [PATCH 2/7] BlockLimits: introduce max_transfer_length
34b321
34b321
RH-Author: Fam Zheng <famz@redhat.com>
34b321
Message-id: <1468215219-30793-3-git-send-email-famz@redhat.com>
34b321
Patchwork-id: 71106
34b321
O-Subject: [RHEL-7.3 qemu-kvm PATCH 2/6] BlockLimits: introduce max_transfer_length
34b321
Bugzilla: 1318199
34b321
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
34b321
RH-Acked-by: John Snow <jsnow@redhat.com>
34b321
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
34b321
34b321
From: Peter Lieven <pl@kamp.de>
34b321
34b321
Signed-off-by: Peter Lieven <pl@kamp.de>
34b321
Reviewed-by: Max Reitz <mreitz@redhat.com>
34b321
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
34b321
(cherry picked from commit 2647fab57d5d5e38b36f8dbda367d688045e6a2d)
34b321
Signed-off-by: Fam Zheng <famz@redhat.com>
34b321
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
34b321
---
34b321
 block.c                   | 4 ++++
34b321
 include/block/block_int.h | 3 +++
34b321
 2 files changed, 7 insertions(+)
34b321
34b321
diff --git a/block.c b/block.c
34b321
index ecb2b09..ae756aa 100644
34b321
--- a/block.c
34b321
+++ b/block.c
34b321
@@ -481,6 +481,7 @@ void bdrv_refresh_limits(BlockDriverState *bs, Error **errp)
34b321
             return;
34b321
         }
34b321
         bs->bl.opt_transfer_length = bs->file->bl.opt_transfer_length;
34b321
+        bs->bl.max_transfer_length = bs->file->bl.max_transfer_length;
34b321
         bs->bl.opt_mem_alignment = bs->file->bl.opt_mem_alignment;
34b321
     } else {
34b321
         bs->bl.opt_mem_alignment = 512;
34b321
@@ -495,6 +496,9 @@ void bdrv_refresh_limits(BlockDriverState *bs, Error **errp)
34b321
         bs->bl.opt_transfer_length =
34b321
             MAX(bs->bl.opt_transfer_length,
34b321
                 bs->backing_hd->bl.opt_transfer_length);
34b321
+        bs->bl.max_transfer_length =
34b321
+            MIN_NON_ZERO(bs->bl.max_transfer_length,
34b321
+                         bs->backing_hd->bl.max_transfer_length);
34b321
         bs->bl.opt_mem_alignment =
34b321
             MAX(bs->bl.opt_mem_alignment,
34b321
                 bs->backing_hd->bl.opt_mem_alignment);
34b321
diff --git a/include/block/block_int.h b/include/block/block_int.h
34b321
index 3f86649..28c34d8 100644
34b321
--- a/include/block/block_int.h
34b321
+++ b/include/block/block_int.h
34b321
@@ -240,6 +240,9 @@ typedef struct BlockLimits {
34b321
     /* optimal transfer length in sectors */
34b321
     int opt_transfer_length;
34b321
 
34b321
+    /* maximal transfer length in sectors */
34b321
+    int max_transfer_length;
34b321
+
34b321
     /* memory alignment so that no bounce buffer is needed */
34b321
     size_t opt_mem_alignment;
34b321
 } BlockLimits;
34b321
-- 
34b321
1.8.3.1
34b321