[libvirt] [PATCH] storage: use btrfs file clone ioctl when possible

Daniel P. Berrange berrange at redhat.com
Fri Sep 27 14:19:06 UTC 2013


On Fri, Sep 27, 2013 at 05:02:53PM +0300, Oskari Saarenmaa wrote:
> Btrfs provides a copy-on-write clone ioctl so let's try to use it instead
> of copying files block by block.  The ioctl is executed unconditionally if
> it's available and we fall back to block copying if it fails, similarly to
> cp --reflink=auto.

Currently the virStorageVolCreateXMLFrom method does a full allocation
of storage when cloning volumes. This means applications can rely on
the image having enough space when clone completes and won't get ENOSPC
in the VM. AFAICT, this change to do copy-on-write changes the API to do
thin provisioning of the storage during clone, so any future write on
either the new or old volume may generate ENOSPC when btrfs finally copies
the sector. I don't think this is a good thing. I think applications
should have to explicitly request copy-on-write behaviour for the clone
so they know the implications.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list