Adam G posted on Wed, 04 Dec 2013 19:19:15 -0500 as excerpted:

> I recreated the problem by booting with autodefrag enabled and loading a
> large VirtualBox image of Windows 8.1. The CPU is pinned to 100%
> even after closing the VirtualBox software.

Virtual images!

That's your problem!  Any large and frequently internally written files 
(as opposed to appended such as logs or write-once files such as most 
media files), including both large databases and virtual machine images, 
are going to be an issue on any COW (copy-on-write) filesystem such as 
btrfs, since they'll very quickly become very heavily fragmented due to 
the constant internal writes creating fragments.

And virtual machine images are a classic example, often being several 
gigs (if not tens of gigs) in size, with frequent writes to data in the 
center of the image.

As a consequence, it's strongly recommended that VM images are set NOCOW, 
so writes will happen in-place, instead of fragmenting the image.  
Without that... well, the poor defragmenter was working overtime to try 
and fix the fragments, and all those fragments were certainly dragging 
down your VM performance as well.

For curiosity sake, you might try running filefrag on that image and see 
just how fragmented it was.

As for setting NOCOW, note that the attribute must be set before the file 
has any data in it.  There are two common ways to do that.  The easy way 
is to create a directory for your VM images and set the attribute on it, 
then copy the vm images into it.  An alternative is to touch the 
individual file to create it at zero size, set the attribute, then copy 
the data into it from the existing file.

After doing that with all your VM images and deleting the old/fragmented 
copies, the pegged cpu defrag thread issue should disappear or at least 
dramatically reduce, and you may well notice a performance boost in your 
VMs as well. =:^)

-- 
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to