SHA256
1
0
forked from pool/qemu
qemu/0027-xen_disk-Add-suse-specific-flush-di.patch
Andreas Färber 724a14a256 Accepting request 487699 from home:bfrogers:branches:Virtualization
Update to rc4 of v2.9.0. Also includes a few other fixes, and a number of tweaks to the spec files. I'd be happy to answer any questions about all those spec file changes, I believe they were all in the direction of a more correct and maintainable spec file. Since this is still in rc phase, let's keep it in devel project. Final release should appear in time for Beta2 of SLE12SP3. Delta from previous: Added Alex's patch for keyboard empty event.

OBS-URL: https://build.opensuse.org/request/show/487699
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=334
2017-04-12 19:10:15 +00:00

66 lines
2.1 KiB
Diff

From 057006621bae63e016910d0125366faa3792eaeb Mon Sep 17 00:00:00 2001
From: Bruce Rogers <brogers@suse.com>
Date: Wed, 9 Mar 2016 15:18:11 -0700
Subject: [PATCH] xen_disk: Add suse specific flush disable handling and map to
QEMU equiv
Add code to read the suse specific suse-diskcache-disable-flush flag out
of xenstore, and set the equivalent flag within QEMU.
Patch taken from Xen's patch queue, Olaf Hering being the original author.
[bsc#879425]
Signed-off-by: Bruce Rogers <brogers@suse.com>
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
hw/block/xen_disk.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c
index 456a2d5694..94e755d3e8 100644
--- a/hw/block/xen_disk.c
+++ b/hw/block/xen_disk.c
@@ -111,6 +111,7 @@ struct XenBlkDev {
int requests_inflight;
int requests_finished;
+ gboolean cache_unsafe;
/* Persistent grants extension */
gboolean feature_discard;
gboolean feature_persistent;
@@ -960,6 +961,16 @@ static void blk_parse_discard(struct XenBlkDev *blkdev)
}
}
+static void blk_parse_cache_unsafe(struct XenBlkDev *blkdev)
+{
+ int enable;
+
+ blkdev->cache_unsafe = false;
+
+ if (xenstore_read_be_int(&blkdev->xendev, "suse-diskcache-disable-flush", &enable) == 0)
+ blkdev->cache_unsafe = !!enable;
+}
+
static int blk_init(struct XenDevice *xendev)
{
struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev);
@@ -1031,6 +1042,7 @@ static int blk_init(struct XenDevice *xendev)
xenstore_write_be_int(&blkdev->xendev, "info", info);
blk_parse_discard(blkdev);
+ blk_parse_cache_unsafe(blkdev);
g_free(directiosafe);
return 0;
@@ -1073,6 +1085,9 @@ static int blk_connect(struct XenDevice *xendev)
qflags |= BDRV_O_UNMAP;
}
+ if (blkdev->cache_unsafe)
+ qflags |= BDRV_O_NO_FLUSH;
+
/* init qemu block driver */
index = (blkdev->xendev.dev - 202 * 256) / 16;
blkdev->dinfo = drive_get(IF_XEN, 0, index);