]> git.ipfire.org Git - thirdparty/libvirt.git/commit
storagevol: add nocow to vol xml
authorChunyan Liu <cyliu@suse.com>
Tue, 15 Jul 2014 08:49:46 +0000 (16:49 +0800)
committerJán Tomko <jtomko@redhat.com>
Wed, 16 Jul 2014 11:35:20 +0000 (13:35 +0200)
commita9fd30e6332a04a8b5ba409dc738ecefa5c1b735
tree47086deae3351c35260afc810223cb01858c7ba5
parent607806f87ffaf33bd6243696c6bc099513fb7ace
storagevol: add nocow to vol xml

Add 'nocow' to storage volume xml so that user can have an option
to set NOCOW flag to the newly created volume. 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 COW 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 'nocow' option, it could set
NOCOW flag per file:
for raw file images, handle 'nocow' in libvirt code; for non-raw file images,
pass 'nocow=on' option to qemu-img, and let qemu-img to handle that (requires
qemu-img version >= 2.1).

Signed-off-by: Chunyan Liu <cyliu@suse.com>
docs/formatstorage.html.in
docs/schemas/storagevol.rng
src/conf/storage_conf.c
src/storage/storage_backend.c
src/util/virstoragefile.h