SHA256
1
0
forked from pool/qemu
qemu/0015-xen_disk-Add-suse-specific-flush-di.patch
Bruce Rogers 3977e7cae6 Accepting request 662931 from home:bfrogers:branches:Virtualization
Follow up on ideas prompted by last change: clean up the patches generated by git workflow. There is no value to the first line (mbox From line), or [PATCH] on subject line. Get rid of those.
Other minor fixes and improvements to update_git.sh

OBS-URL: https://build.opensuse.org/request/show/662931
OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=443
2019-01-04 21:08:16 +00:00

70 lines
2.0 KiB
Diff

From: Bruce Rogers <brogers@suse.com>
Date: Wed, 9 Mar 2016 15:18:11 -0700
Subject: 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]
[BR: minor edits to pass qemu's checkpatch script]
Signed-off-by: Bruce Rogers <brogers@suse.com>
Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
hw/block/xen_disk.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c
index 36eff94f84..ddd5c7cbfd 100644
--- a/hw/block/xen_disk.c
+++ b/hw/block/xen_disk.c
@@ -90,6 +90,8 @@ struct XenBlkDev {
int requests_finished;
unsigned int max_requests;
+ gboolean cache_unsafe;
+ /* Persistent grants extension */
gboolean feature_discard;
/* qemu block driver */
@@ -642,6 +644,18 @@ 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);
@@ -717,6 +731,7 @@ static int blk_init(struct XenDevice *xendev)
MAX_RING_PAGE_ORDER);
blk_parse_discard(blkdev);
+ blk_parse_cache_unsafe(blkdev);
g_free(directiosafe);
return 0;
@@ -764,6 +779,10 @@ 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 = (xendev->dev - 202 * 256) / 16;
blkdev->dinfo = drive_get(IF_XEN, 0, index);