qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH V4] qemu-img create: add 'nocow' option


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH V4] qemu-img create: add 'nocow' option
Date: Mon, 30 Jun 2014 15:53:05 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

On Mon, Jun 30, 2014 at 02:29:58PM +0800, Chunyan Liu wrote:
> 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.
> 
> Signed-off-by: Chunyan Liu <address@hidden>
> ---
>   Changes to v3:
>     * remove NOCOW option from .create_opts of those drivers calling
>       bdrv_create_file to create file. Adding NOCOW to raw-posix.c is
>       enough. No difference to users when using 'qemu-img create' interface.
>       Make the patch cleaner. 
> 
>  block/qed.c               |  6 +++---
>  block/raw-posix.c         | 25 +++++++++++++++++++++++++
>  block/vdi.c               | 29 +++++++++++++++++++++++++++++
>  block/vmdk.c              |  6 +++---
>  block/vpc.c               | 29 +++++++++++++++++++++++++++++
>  include/block/block_int.h |  1 +
>  qemu-doc.texi             | 16 ++++++++++++++++
>  qemu-img.texi             | 16 ++++++++++++++++
>  8 files changed, 122 insertions(+), 6 deletions(-)

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan

Attachment: pgpjOaJMYl1xB.pgp
Description: PGP signature


reply via email to

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