* Odd block-count behaviour
@ 2010-06-16 12:47 Hugo Mills
2010-06-17 9:16 ` Chris Mason
0 siblings, 1 reply; 2+ messages in thread
From: Hugo Mills @ 2010-06-16 12:47 UTC (permalink / raw)
To: linux-btrfs
[-- Attachment #1: Type: text/plain, Size: 1093 bytes --]
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.
I'm running a linux.org 2.6.32.2 kernel, and the destination
filesystem has just been created using the most recent btrfs tools.
Hugo.
--
=== Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk ===
PGP key: 515C238D from wwwkeys.eu.pgp.net or http://www.carfax.org.uk
--- There's many a slip 'twixt wicket-keeper and gully. ---
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Odd block-count behaviour
2010-06-16 12:47 Odd block-count behaviour Hugo Mills
@ 2010-06-17 9:16 ` Chris Mason
0 siblings, 0 replies; 2+ messages in thread
From: Chris Mason @ 2010-06-17 9:16 UTC (permalink / raw)
To: Hugo Mills, linux-btrfs
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-06-17 9:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-16 12:47 Odd block-count behaviour Hugo Mills
2010-06-17 9:16 ` Chris Mason
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).