<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">2013/12/6 Chunyan Liu <span dir="ltr"><<a href="mailto:cyliu@suse.com" target="_blank">cyliu@suse.com</a>></span><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">2013/12/5 Daniel P. Berrange <span dir="ltr"><<a href="mailto:berrange@redhat.com" target="_blank">berrange@redhat.com</a>></span><div class="im">
<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>On Thu, Dec 05, 2013 at 06:35:12PM +0800, Chunyan Liu wrote:<br>
> Btrfs has terrible performance when hosting VM images, even more when the guest<br>
> in those VM are also using btrfs as file system. One way to mitigate this bad<br>
> performance is to turn off COW attributes on VM files (since having copy on<br>
> write for this kind of data is not useful).<br>
><br>
> According to 'chattr' manpage, NOCOW could be set to new or empty file only on<br>
> btrfs, so this patch tries to add a --nocow option to vol-create functions and<br>
> vol-clone function, so that users could have a chance to set NOCOW to a new<br>
> volume if that happens to create on a btrfs like file system.<br>
<br>
</div>What effect / impact does setting this flag have from a functional<br>
POV ? </blockquote></div><div> <br>It implies nodatasum as well. But COW may still happen if a snapshot is taken.<br><br>Following is quoted from:<br> <a href="https://btrfs.wiki.kernel.org/index.php/FAQ" target="_blank">https://btrfs.wiki.kernel.org/index.php/FAQ</a><br>

 <br> Can copy-on-write be turned off for data blocks?<br><br> Yes, there are several ways how to do that.<br><br> Disable it by mounting with nodatacow. This implies nodatasum as well. COW may<br>still happen if a snapshot is taken. However COW will still be maintained for<br>

existing files, because the COW status can be modified only for empty or newly<br>created files.<br><br> For an empty file, add the NOCOW file attribute (use chattr utility with +C),<br> or you create a new file in a directory with the NOCOW attribute set (then the<br>

 new file will inherit this attribute). Now copy the original data into the <br> pre-created file, delete original and rename back. <br><br></div><div class="im"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

 Why would we not just unconditonally enable it on btrfs so<br>
it was fast "out of the box" ?</blockquote></div><div><br> COW is default feature of Btrfs. There are many advantages with COW mechanism.<br> Other uses may want the COW advantages at the same time we set NOCOW to a VM <br>

 image. <br><br> But in pool-create and vol-create case, it seems the whole pool is used <br> to hold VM images, so maybe we could just disable COW in pool side. Then all<br> vol created in it will be NOCOW. That means, in pool-start phase, if checking <br>

 fs format is 'btrfs', add '-o nodatacow' option to 'mount' command. That still need some<br> change in libvirt code. How do you think about this way?<br></div></div></div></div></blockquote><div>
<br></div><div>Daniel, about the nocow issue, could we do <span class=""><em>mount</em> -o <em>nodatacow</em></span> in pool-start if checked<br>that fs format is btrfs?<br><br></div><div>Chunyan<br></div><div> <br></div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div></div><div><br></div><div>Thanks,<br>
Chunyan<br>
</div><div class="im"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> I'm loathe to add a btrfs-specific<br>
flag to our public API.<br>
<span><font color="#888888"><br>
Daniel<br>
--<br>
|: <a href="http://berrange.com" target="_blank">http://berrange.com</a>      -o-    <a href="http://www.flickr.com/photos/dberrange/" target="_blank">http://www.flickr.com/photos/dberrange/</a> :|<br>
|: <a href="http://libvirt.org" target="_blank">http://libvirt.org</a>              -o-             <a href="http://virt-manager.org" target="_blank">http://virt-manager.org</a> :|<br>
|: <a href="http://autobuild.org" target="_blank">http://autobuild.org</a>       -o-         <a href="http://search.cpan.org/~danberr/" target="_blank">http://search.cpan.org/~danberr/</a> :|<br>
|: <a href="http://entangle-photo.org" target="_blank">http://entangle-photo.org</a>       -o-       <a href="http://live.gnome.org/gtk-vnc" target="_blank">http://live.gnome.org/gtk-vnc</a> :|<br>
<br>
</font></span></blockquote></div></div><br></div></div>
</blockquote></div><br></div></div>