This patch adds a new option preallocation for raw format, and implements
falloc and full preallocation.
Signed-off-by: Hu Tao <address@hidden>
---
block/raw-posix.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++-------
1 file changed, 55 insertions(+), 7 deletions(-)
diff --git a/block/raw-posix.c b/block/raw-posix.c
index 58c51d8..5dcd465 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -30,6 +30,7 @@
#include "block/thread-pool.h"
#include "qemu/iov.h"
#include "raw-aio.h"
+#include "qapi/util.h"
#if defined(__APPLE__) && (__MACH__)
#include <paths.h>
@@ -1278,28 +1279,70 @@ static int raw_create(const char *filename, QemuOpts
*opts, Error **errp)
int fd;
int result = 0;
int64_t total_size = 0;
+ PreallocMode prealloc = PREALLOC_MODE_OFF;
+ char *buf = NULL;