diff options
author | Kevin Wolf <kwolf@redhat.com> | 2016-03-15 13:38:43 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2016-03-30 12:16:01 +0200 |
commit | ecdd3cc82d7f5dd181ad74d8c4d04f5295b1bcf7 (patch) | |
tree | f69c26c3e2d6db252a8d7ddaa549b19dd4c41f0a | |
parent | ce09954720d4d59b682b45d622e62ec13c332070 (diff) |
xen_disk: Call blk_set_enable_write_cache() explicitly
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
-rw-r--r-- | hw/block/xen_disk.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c index e619a1f7d9..d4ce380fee 100644 --- a/hw/block/xen_disk.c +++ b/hw/block/xen_disk.c @@ -889,12 +889,14 @@ static int blk_connect(struct XenDevice *xendev) struct XenBlkDev *blkdev = container_of(xendev, struct XenBlkDev, xendev); int pers, index, qflags; bool readonly = true; + bool writethrough = true; /* read-only ? */ if (blkdev->directiosafe) { qflags = BDRV_O_NOCACHE | BDRV_O_NATIVE_AIO; } else { - qflags = BDRV_O_CACHE_WB; + qflags = 0; + writethrough = false; } if (strcmp(blkdev->mode, "w") == 0) { qflags |= BDRV_O_RDWR; @@ -926,6 +928,7 @@ static int blk_connect(struct XenDevice *xendev) error_free(local_err); return -1; } + blk_set_enable_write_cache(blkdev->blk, !writethrough); } else { /* setup via qemu cmdline -> already setup for us */ xen_be_printf(&blkdev->xendev, 2, "get configured bdrv (cmdline setup)\n"); |