qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH v2 1/6] block: introduce prealloc_mode


From: Hu Tao
Subject: [Qemu-devel] [RFC PATCH v2 1/6] block: introduce prealloc_mode
Date: Wed, 27 Nov 2013 10:15:39 +0800

This patch prepares for the subsequent patches.

Signed-off-by: Hu Tao <address@hidden>
---
 block/qcow2.c         | 6 +++---
 include/block/block.h | 6 ++++++
 2 files changed, 9 insertions(+), 3 deletions(-)

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
-- 
1.8.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]