On Wed, Jun 16, 2010 at 01:47:30PM +0100, Hugo Mills wrote: > Hi, > > I've just been copying large quantities of data from one btrfs > volume to another, and while watching the progress of the copy, I've > noticed something odd. > > $ mv source-dir dest-dir > $ watch du -ms source-dir dest-dir > > This gives me a count of the size of the source and target > directories, every 2 seconds. As expected, the size of the source dir > stays constant, and the size of the destination directory increases. > Except when it doesn't. > > Occasionally, while copying, the size of the dest-dir *drops* by > several (tens of) megabytes. I'm not too worried about this, as it all > seems to be copying the data OK, but it just seems a bit odd, and was > wondering of there was a sane explanation for this behaviour. If the files are small, they can be packed into the metadata btree. But this doesn't happen until the file is actually written. So we start with a worst case estimate on the number of blocks the file will consume (4k) and then when it is actually written we update the metadata to reflect the number of blocks it is actually using (maybe 1 or 2). You can see this with a test: mkdir testdir cd testdir dd if=/dev/zero of=foo bs=512 count=1 du -k . sync du -k . -chris -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html
