Olaf Hering
7adb207e17
- Update to v2.6.0-rc0: See http://wiki.qemu-project.org/ChangeLog/2.6 * Patch queue updated from git://github.com/openSUSE/qemu.git opensuse-2.6 * Accept every size in DISCARD request from a guest (bsc#964427) 0039-block-split-large-discard-requests-.patch * Recognize libxl flag to disable flush in block device (bsc#879425) 0040-xen_disk-Add-suse-specific-flush-di.patch * Use correct flag for crypto tests 0041-tests-Use-correct-config-param-for-.patch * Fix build on powerpc: 0042-build-link-with-libatomic-on-powerp.patch * Patches dropped (upstreamed): seabios_checkrom_typo.patch seabios_avoid_smbios_signature_string.patch OBS-URL: https://build.opensuse.org/request/show/383004 OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=289
57 lines
1.7 KiB
Diff
57 lines
1.7 KiB
Diff
From 88f6de6e8b1f91c71e56fa8125cc6fae2b53e725 Mon Sep 17 00:00:00 2001
|
|
From: Olaf Hering <olaf@aepfle.de>
|
|
Date: Thu, 24 Mar 2016 14:32:39 +0100
|
|
Subject: [PATCH] block: split large discard requests from block frontend
|
|
|
|
Large discard requests lead to sign expansion errors in qemu.
|
|
Since there is no API to tell a guest about the limitations qmeu
|
|
has to split a large request itself.
|
|
|
|
[bsc#964427]
|
|
|
|
Signed-off-by: Olaf Hering <olaf@aepfle.de>
|
|
---
|
|
block/io.c | 22 +++++++++++++++++++++-
|
|
1 file changed, 21 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/block/io.c b/block/io.c
|
|
index c4869b9..5b6ed58 100644
|
|
--- a/block/io.c
|
|
+++ b/block/io.c
|
|
@@ -2442,7 +2442,7 @@ static void coroutine_fn bdrv_discard_co_entry(void *opaque)
|
|
rwco->ret = bdrv_co_discard(rwco->bs, rwco->sector_num, rwco->nb_sectors);
|
|
}
|
|
|
|
-int coroutine_fn bdrv_co_discard(BlockDriverState *bs, int64_t sector_num,
|
|
+static int __bdrv_co_discard(BlockDriverState *bs, int64_t sector_num,
|
|
int nb_sectors)
|
|
{
|
|
BdrvTrackedRequest req;
|
|
@@ -2524,6 +2524,26 @@ out:
|
|
return ret;
|
|
}
|
|
|
|
+int coroutine_fn bdrv_co_discard(BlockDriverState *bs, int64_t sector_num,
|
|
+ int nb_sectors)
|
|
+{
|
|
+ int num, ret;
|
|
+ int limit = BDRV_REQUEST_MAX_SECTORS;
|
|
+ int remaining = nb_sectors;
|
|
+ int64_t sector_offset = sector_num;
|
|
+
|
|
+ do {
|
|
+ num = remaining > limit ? limit : remaining;
|
|
+ ret = __bdrv_co_discard(bs, sector_offset, num);
|
|
+ if (ret < 0)
|
|
+ break;
|
|
+ remaining -= num;
|
|
+ sector_offset += num;
|
|
+ } while (remaining > 0);
|
|
+
|
|
+ return ret;
|
|
+}
|
|
+
|
|
int bdrv_discard(BlockDriverState *bs, int64_t sector_num, int nb_sectors)
|
|
{
|
|
Coroutine *co;
|