[pve-devel] [PATCH] rbd : add writethrough/writeback option
Alexandre Derumier
aderumier at odiso.com
Sat Jun 16 16:02:50 CEST 2012
This patch add writethrough/writeback support to qemu-rbd.
It'll be merge in qemu 1.2, as 1.1 in feature froze for the moment.
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
debian/patches/rbd-enable-cacheoption.patch | 37 +++++++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 38 insertions(+), 0 deletions(-)
create mode 100644 debian/patches/rbd-enable-cacheoption.patch
diff --git a/debian/patches/rbd-enable-cacheoption.patch b/debian/patches/rbd-enable-cacheoption.patch
new file mode 100644
index 0000000..864b134
--- /dev/null
+++ b/debian/patches/rbd-enable-cacheoption.patch
@@ -0,0 +1,37 @@
+Signed-off-by: Josh Durgin <address at hidden>
+---
+ block/rbd.c | 19 +++++++++++++++++++
+ 1 files changed, 19 insertions(+), 0 deletions(-)
+
+diff --git a/block/rbd.c b/block/rbd.c
+index 1280d66..eebc334 100644
+--- a/block/rbd.c
++++ b/block/rbd.c
+@@ -476,6 +476,25 @@ static int qemu_rbd_open(BlockDriverState *bs, const char *filename, int flags)
+ s->snap = g_strdup(snap_buf);
+ }
+
++ /*
++ * Fallback to more conservative semantics if setting cache
++ * options fails. Ignore errors from setting rbd_cache because the
++ * only possible error is that the option does not exist, and
++ * librbd defaults to no caching. If write through caching cannot
++ * be set up, fall back to no caching.
++ */
++ if (flags & BDRV_O_NOCACHE) {
++ rados_conf_set(s->cluster, "rbd_cache", "false");
++ } else {
++ rados_conf_set(s->cluster, "rbd_cache", "true");
++ if (!(flags & BDRV_O_CACHE_WB)) {
++ r = rados_conf_set(s->cluster, "rbd_cache_max_dirty", "0");
++ if (r < 0) {
++ rados_conf_set(s->cluster, "rbd_cache", "false");
++ }
++ }
++ }
++
+ if (strstr(conf, "conf=") == NULL) {
+ /* try default location, but ignore failure */
+ rados_conf_read_file(s->cluster, NULL);
+--
+1.7.5.4
diff --git a/debian/patches/series b/debian/patches/series
index 4b5d221..ab59a91 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,3 +5,4 @@ keymap.diff
set-max-nics.patch
pve-auth.patch
update-cpus-x86_64.conf-to-rhel6.2-version.patch
+rbd-enable-cacheoption.patch
--
1.7.2.5
More information about the pve-devel
mailing list