diff mbox

[RFC,v2,1/6] block: introduce prealloc_mode

Message ID 1cf6410499cb9eadc8d3a33cd29ff6b5e58db871.1385518315.git.hutao@cn.fujitsu.com
State New
Headers show

Commit Message

Hu Tao Nov. 27, 2013, 2:15 a.m. UTC
This patch prepares for the subsequent patches.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
---
 block/qcow2.c         | 6 +++---
 include/block/block.h | 6 ++++++
 2 files changed, 9 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/block/qcow2.c b/block/qcow2.c
index 6e5d98d..b054a01 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1608,7 +1608,7 @@  static int qcow2_create(const char *filename, QEMUOptionParameter *options,
     uint64_t sectors = 0;
     int flags = 0;
     size_t cluster_size = DEFAULT_CLUSTER_SIZE;
-    int prealloc = 0;
+    int prealloc = PREALLOC_OFF;
     int version = 3;
     Error *local_err = NULL;
     int ret;
@@ -1629,9 +1629,9 @@  static int qcow2_create(const char *filename, QEMUOptionParameter *options,
             }
         } else if (!strcmp(options->name, BLOCK_OPT_PREALLOC)) {
             if (!options->value.s || !strcmp(options->value.s, "off")) {
-                prealloc = 0;
+                prealloc = PREALLOC_OFF;
             } else if (!strcmp(options->value.s, "metadata")) {
-                prealloc = 1;
+                prealloc = PREALLOC_METADATA;
             } else {
                 error_setg(errp, "Invalid preallocation mode: '%s'",
                            options->value.s);
diff --git a/include/block/block.h b/include/block/block.h
index 3560deb..461eaa4 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -487,4 +487,10 @@  int bdrv_debug_breakpoint(BlockDriverState *bs, const char *event,
 int bdrv_debug_resume(BlockDriverState *bs, const char *tag);
 bool bdrv_debug_is_suspended(BlockDriverState *bs, const char *tag);
 
+enum prealloc_mode {
+    PREALLOC_OFF = 0,
+    PREALLOC_METADATA,
+    PREALLOC_FULL,
+};
+
 #endif