summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChunyan Liu <cyliu@suse.com>2014-06-30 14:29:58 +0800
committerStefan Hajnoczi <stefanha@redhat.com>2014-07-01 10:15:12 +0200
commit4ab1559085d688dddf4de77f1ead3102e243e668 (patch)
treec02aaa834a94aace2ef773462cea3b4829cc48a9 /include
parent8698e110f8aa1cdf8ba1afdda8f2658333a4ab01 (diff)
qemu-img create: add 'nocow' option
Add 'nocow' option so that users could have a chance to set NOCOW flag to newly created files. It's useful on btrfs file system to enhance performance. Btrfs has low performance when hosting VM images, even more when the guest in those VM are also using btrfs as file system. One way to mitigate this bad performance is to turn off COW attributes on VM files. Generally, there are two ways to turn off NOCOW on btrfs: a) by mounting fs with nodatacow, then all newly created files will be NOCOW. b) per file. Add the NOCOW file attribute. It could only be done to empty or new files. This patch tries the second way, according to the option, it could add NOCOW per file. For most block drivers, since the create file step is in raw-posix.c, so we can do setting NOCOW flag ioctl in raw-posix.c only. But there are some exceptions, like block/vpc.c and block/vdi.c, they are creating file by calling qemu_open directly. For them, do the same setting NOCOW flag ioctl work in them separately. [Fixed up 082.out due to the new 'nocow' creation option --Stefan] Signed-off-by: Chunyan Liu <cyliu@suse.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/block/block_int.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 53e77cf11e..eaf6e313d5 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -54,6 +54,7 @@
#define BLOCK_OPT_LAZY_REFCOUNTS "lazy_refcounts"
#define BLOCK_OPT_ADAPTER_TYPE "adapter_type"
#define BLOCK_OPT_REDUNDANCY "redundancy"
+#define BLOCK_OPT_NOCOW "nocow"
typedef struct BdrvTrackedRequest {
BlockDriverState *bs;