[mythtv] Ticket #6846: FreeSpace calculations don't work correctly
Chris Pinkham
cpinkham at bc2va.org
Sun Aug 16 01:50:53 UTC 2009
* On Sat Aug 15, 2009 at 09:53:13AM -0500, Eric Bosch wrote:
> I'll give it a test and see if it resolves it. Thanks.
Short story:
svn update again and this should be fixed...
Long story:
I saw your comment in the ticket, thanks for the df's.
> Filesystem 1K-blocks Used Available Use% Mounted on
> /dev/sda3 974529356 535549500 438979856 55% /
> gandalf scripts # df -k /videonfs/
> Filesystem 1K-blocks Used Available Use% Mounted on
> saruman:/video 930209280 60635136 869574144 7% /videonfs
> saruman ~ # df -k /video
> Filesystem 1K-blocks Used Available Use% Mounted on
> /dev/sda4 930209140 60691568 869517572 7% /video
> saruman ~ # df -k /videonfs/
> Filesystem 1K-blocks Used Available Use% Mounted on
> gandalf:/video 974529536 535549952 438979584 55% /videonfs
From this output, we get the following numbers:
saruman:/video
size diff = 974529536 - 974529356 = 180K
used diff = 535549952 - 535549500 = 452K
avail diff = 438979856 - 438979584 = 272K
Interesting that the diff between the avail and used is 180K which is
the size diff. We only use the total space and the used space in our
comparisons. We only have a 32K fuzzy comparison for the size
diff, so we assume these are separate disks no matter what the used
space says. In this case the used diff is below the 2M that Michael
mentioned, so the total size diff is what's hurting us.
For gandalf:/video, we have this:
gandalf:/video
size diff = 930209280 - 930209140 = 140K
used diff = 60691568 - 60635136 = 56432K
avail diff = 869574144 - 869517572 = 56572K
So on this one, we fail both tests, because the total size diff is
greater than 32K and the available space differs by over 56 MegaBytes.
Did you run those commands at the same time and if so, was there something
else writing to or being deleted from the disk at the time?
Recent Linux kernels can use up to a 1 MegaByte block size. This means
that the total free space numbers can differ up to 1 MegaByte. I just
committed a patch which changes our 32KiloByte fuzzy comparison to
use the max of the following 3 values when making the comparison:
- fs#1 block size
- fs#2 block size
- 32 KiloBytes
So, we maintain existing functionality unless the filesystem is mounted
with a block size > 32K and in that situation we use the mounted block
size. Locally, the block size is going to be something like 4K or 8K,
the NFS mount may show 32K, 64K or anything up to 1024K.
--
Chris
More information about the mythtv-dev
mailing list