]> git.proxmox.com Git - pve-qemu.git/commitdiff
merge: vma & rbd changes
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 5 Apr 2018 09:04:11 +0000 (11:04 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 5 Apr 2018 09:04:11 +0000 (11:04 +0200)
vma: remove forced NO_FLUSH option
rbd: fix cache mode behavior
vma: add cache option to device map

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
debian/patches/pve/0031-vma-add-cache-option-to-device-map.patch [new file with mode: 0644]
debian/patches/pve/0032-rbd-fix-cache-mode-behavior.patch [new file with mode: 0644]
debian/patches/pve/0033-vma-remove-forced-NO_FLUSH-option.patch [new file with mode: 0644]
debian/patches/series

diff --git a/debian/patches/pve/0031-vma-add-cache-option-to-device-map.patch b/debian/patches/pve/0031-vma-add-cache-option-to-device-map.patch
new file mode 100644 (file)
index 0000000..a84d519
--- /dev/null
@@ -0,0 +1,103 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Wolfgang Bumiller <w.bumiller@proxmox.com>
+Date: Thu, 22 Mar 2018 15:32:04 +0100
+Subject: [PATCH] vma: add cache option to device map
+
+Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
+---
+ vma.c | 17 ++++++++++++++++-
+ 1 file changed, 16 insertions(+), 1 deletion(-)
+
+diff --git a/vma.c b/vma.c
+index 71be120cfc..e0271060af 100644
+--- a/vma.c
++++ b/vma.c
+@@ -20,6 +20,7 @@
+ #include "qemu/main-loop.h"
+ #include "qemu/cutils.h"
+ #include "qapi/qmp/qstring.h"
++#include "qapi/qmp/qbool.h"
+ #include "sysemu/block-backend.h"
+ static void help(void)
+@@ -135,6 +136,7 @@ typedef struct RestoreMap {
+     char *format;
+     uint64_t throttling_bps;
+     char *throttling_group;
++    char *cache;
+     bool write_zero;
+ } RestoreMap;
+@@ -242,6 +244,7 @@ static int extract_content(int argc, char **argv)
+             char *format = NULL;
+             char *bps = NULL;
+             char *group = NULL;
++            char *cache = NULL;
+             if (!line || line[0] == '\0' || !strcmp(line, "done\n")) {
+                 break;
+             }
+@@ -256,7 +259,8 @@ static int extract_content(int argc, char **argv)
+             while (1) {
+                 if (!try_parse_option(&line, "format", &format, inbuf) &&
+                     !try_parse_option(&line, "throttling.bps", &bps, inbuf) &&
+-                    !try_parse_option(&line, "throttling.group", &group, inbuf))
++                    !try_parse_option(&line, "throttling.group", &group, inbuf) &&
++                    !try_parse_option(&line, "cache", &cache, inbuf))
+                 {
+                     break;
+                 }
+@@ -293,6 +297,7 @@ static int extract_content(int argc, char **argv)
+             map->format = format;
+             map->throttling_bps = bps_value;
+             map->throttling_group = group;
++            map->cache = cache;
+             map->write_zero = write_zero;
+             g_hash_table_insert(devmap, map->devname, map);
+@@ -322,6 +327,7 @@ static int extract_content(int argc, char **argv)
+             const char *format = NULL;
+             uint64_t throttling_bps = 0;
+             const char *throttling_group = NULL;
++            const char *cache = NULL;
+             int flags = BDRV_O_RDWR | BDRV_O_NO_FLUSH;
+             bool write_zero = true;
+@@ -335,6 +341,7 @@ static int extract_content(int argc, char **argv)
+                 format = map->format;
+                 throttling_bps = map->throttling_bps;
+                 throttling_group = map->throttling_group;
++                cache = map->cache;
+                 write_zero = map->write_zero;
+             } else {
+                 devfn = g_strdup_printf("%s/tmp-disk-%s.raw",
+@@ -356,6 +363,7 @@ static int extract_content(int argc, char **argv)
+           size_t devlen = strlen(devfn);
+           QDict *options = NULL;
++            bool writethrough;
+             if (format) {
+                 /* explicit format from commandline */
+                 options = qdict_new();
+@@ -370,12 +378,19 @@ static int extract_content(int argc, char **argv)
+               options = qdict_new();
+               qdict_put(options, "driver", qstring_from_str("raw"));
+           }
++            if (cache && bdrv_parse_cache_mode(cache, &flags, &writethrough)) {
++                g_error("invalid cache option: %s\n", cache);
++            }
+           if (errp || !(blk = blk_new_open(devfn, NULL, options, flags, &errp))) {
+                 g_error("can't open file %s - %s", devfn,
+                         error_get_pretty(errp));
+             }
++            if (cache) {
++                blk_set_enable_write_cache(blk, !writethrough);
++            }
++
+             if (throttling_group) {
+                 blk_io_limits_enable(blk, throttling_group);
+             }
+-- 
+2.11.0
+
diff --git a/debian/patches/pve/0032-rbd-fix-cache-mode-behavior.patch b/debian/patches/pve/0032-rbd-fix-cache-mode-behavior.patch
new file mode 100644 (file)
index 0000000..c03f147
--- /dev/null
@@ -0,0 +1,34 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Wolfgang Bumiller <w.bumiller@proxmox.com>
+Date: Mon, 26 Mar 2018 14:20:31 +0200
+Subject: [PATCH] rbd: fix cache mode behavior
+
+Either the cache mode asks for a cache or not. There's no
+point in having a "temporary" cache mode. This option AFAIK
+was introduced as a hack for ancient virtio drivers. If
+anything, we should have a separate option for it. Better
+yet, VMs affected by the related issue should simply
+explicitly choose writethrough.
+
+Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
+---
+ block/rbd.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/block/rbd.c b/block/rbd.c
+index a33738a254..7930ef3368 100644
+--- a/block/rbd.c
++++ b/block/rbd.c
+@@ -642,9 +642,7 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
+         rados_conf_set(s->cluster, "rbd_cache", "true");
+     }
+-    if (flags & BDRV_O_NO_FLUSH) {
+       rados_conf_set(s->cluster, "rbd_cache_writethrough_until_flush", "false");
+-    }
+     r = rados_connect(s->cluster);
+     if (r < 0) {
+-- 
+2.11.0
+
diff --git a/debian/patches/pve/0033-vma-remove-forced-NO_FLUSH-option.patch b/debian/patches/pve/0033-vma-remove-forced-NO_FLUSH-option.patch
new file mode 100644 (file)
index 0000000..6eb7d99
--- /dev/null
@@ -0,0 +1,30 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Wolfgang Bumiller <w.bumiller@proxmox.com>
+Date: Tue, 27 Mar 2018 10:49:03 +0200
+Subject: [PATCH] vma: remove forced NO_FLUSH option
+
+This one's rbd specific and in no way a sane choice for all
+types storages. Instead, we want to honor the cache option
+passed along.
+
+Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
+---
+ vma.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/vma.c b/vma.c
+index e0271060af..463d9f5412 100644
+--- a/vma.c
++++ b/vma.c
+@@ -328,7 +328,7 @@ static int extract_content(int argc, char **argv)
+             uint64_t throttling_bps = 0;
+             const char *throttling_group = NULL;
+             const char *cache = NULL;
+-            int flags = BDRV_O_RDWR | BDRV_O_NO_FLUSH;
++            int flags = BDRV_O_RDWR;
+             bool write_zero = true;
+             if (readmap) {
+-- 
+2.11.0
+
index ca31fa3603d63060907bb371d871936d752180d2..058abd738a9da958ea3b2be97861e59e8fe92d2e 100644 (file)
@@ -28,5 +28,8 @@ pve/0027-adding-old-vma-files.patch
 pve/0028-vma-add-throttling-options-to-drive-mapping-fifo-pro.patch
 pve/0029-qemu-img-dd-add-isize-parameter.patch
 pve/0030-qemu-img-dd-add-n-skip_create.patch
+pve/0031-vma-add-cache-option-to-device-map.patch
+pve/0032-rbd-fix-cache-mode-behavior.patch
+pve/0033-vma-remove-forced-NO_FLUSH-option.patch
 extra/0001-Revert-target-i386-disable-LINT0-after-reset.patch
 extra/0002-ratelimit-don-t-align-wait-time-with-slices.patch