[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 11/12] rbd: hook up cache options
|
From: |
Kevin Wolf |
|
Subject: |
[Qemu-devel] [PATCH 11/12] rbd: hook up cache options |
|
Date: |
Mon, 4 Jun 2012 13:13:28 +0200 |
From: Josh Durgin <address@hidden>
Writeback caching was added in Ceph 0.46, and writethrough will be in
0.47. These are controlled by general config options, so there's no
need to check for librbd version.
Signed-off-by: Josh Durgin <address@hidden>
Signed-off-by: Kevin Wolf <address@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.6.5
- Re: [Qemu-devel] [PATCH 02/12] qcow2: fix the byte endian convertion, (continued)
- [Qemu-devel] [PATCH 06/12] stream: move rate limiting to a separate header file, Kevin Wolf, 2012/06/04
- [Qemu-devel] [PATCH 05/12] stream: move is_allocated_above to block.c, Kevin Wolf, 2012/06/04
- [Qemu-devel] [PATCH 10/12] qcow2: Support for fixing refcount inconsistencies, Kevin Wolf, 2012/06/04
- [Qemu-devel] [PATCH 08/12] qemu-img check -r for repairing images, Kevin Wolf, 2012/06/04
- [Qemu-devel] [PATCH 09/12] qemu-img check: Print fixed clusters and recheck, Kevin Wolf, 2012/06/04
- [Qemu-devel] [PATCH 07/12] Un-inline fdctrl_init_isa(), Kevin Wolf, 2012/06/04
- [Qemu-devel] [PATCH 03/12] block: implement is_allocated for raw, Kevin Wolf, 2012/06/04
- [Qemu-devel] [PATCH 11/12] rbd: hook up cache options,
Kevin Wolf <=
- [Qemu-devel] [PATCH 04/12] stream: tweak usage of bdrv_co_is_allocated, Kevin Wolf, 2012/06/04
- [Qemu-devel] [PATCH 12/12] sheepdog: add coroutine_fn markers to coroutine functions, Kevin Wolf, 2012/06/04
- Re: [Qemu-devel] [PULL 00/12] Block patches, Anthony Liguori, 2012/06/06