aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2016-03-18 15:36:58 +0100
committerKevin Wolf <kwolf@redhat.com>2016-03-30 12:16:03 +0200
commit53e8ae010071637b4317402e2ece9e4dbb329c50 (patch)
tree4ba79ff3c70aab8d7f5f6b9057158b9bb84d0bd5 /block.c
parent19dbecdceef3f0800a96c25931d71b0b82c3a47a (diff)
block: Remove bdrv_parse_cache_flags()
All users are converted to bdrv_parse_cache_mode() now. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/block.c b/block.c
index 4e27c49a75..eae597e756 100644
--- a/block.c
+++ b/block.c
@@ -645,21 +645,23 @@ int bdrv_parse_discard_flags(const char *mode, int *flags)
*
* Return 0 on success, -1 if the cache mode was invalid.
*/
-int bdrv_parse_cache_flags(const char *mode, int *flags)
+int bdrv_parse_cache_mode(const char *mode, int *flags, bool *writethrough)
{
*flags &= ~BDRV_O_CACHE_MASK;
if (!strcmp(mode, "off") || !strcmp(mode, "none")) {
- *flags |= BDRV_O_NOCACHE | BDRV_O_CACHE_WB;
+ *writethrough = false;
+ *flags |= BDRV_O_NOCACHE;
} else if (!strcmp(mode, "directsync")) {
+ *writethrough = true;
*flags |= BDRV_O_NOCACHE;
} else if (!strcmp(mode, "writeback")) {
- *flags |= BDRV_O_CACHE_WB;
+ *writethrough = false;
} else if (!strcmp(mode, "unsafe")) {
- *flags |= BDRV_O_CACHE_WB;
+ *writethrough = false;
*flags |= BDRV_O_NO_FLUSH;
} else if (!strcmp(mode, "writethrough")) {
- /* this is the default */
+ *writethrough = true;
} else {
return -1;
}
@@ -667,23 +669,6 @@ int bdrv_parse_cache_flags(const char *mode, int *flags)
return 0;
}
-int bdrv_parse_cache_mode(const char *mode, int *flags, bool *writethrough)
-{
- int ret = bdrv_parse_cache_flags(mode, flags);
- if (ret < 0) {
- return ret;
- }
-
- if (*flags & BDRV_O_CACHE_WB) {
- *flags &= ~BDRV_O_CACHE_WB;
- *writethrough = false;
- } else {
- *writethrough = true;
- }
-
- return 0;
-}
-
/*
* Returns the options and flags that a temporary snapshot should get, based on
* the originally requested flags (the originally requested image will have